Quote:
Originally Posted by jayhawk785
It would be nice if you could share this?
|
I actually found someone to do this on my site in database mode, realy nice! I switched over to File mode, and now I just have red X's. Anyone wouldn't know how to take a hack like this and convert it from using the database images over to the file system??
Here is the garage code found in my vbgarage.php for the random images, if that wil help anyone thats wants to give this code a shot to tell it to pull the random pics from the file system instead of the database
PHP Code:
// START OPAQUE
if ($_REQUEST['do'] == 'randompic')
{
globalize($_REQUEST, array( 'id' => INT ));
globalize($_REQUEST, array( 'garage' => INT ));
if (empty($id) )
{
eval (print_standard_error('error_requiredfields'));
}
// filesystem hack (nop)
if( !$vbg_use_fs )
{
// get thumbnail from DB
$image = $DB_site->query_first("
SELECT thumb,userid FROM " . TABLE_PREFIX ."vbgarage_images WHERE userid = $id AND id = $garage LIMIT 1
");
if(!$image)
{
$imagee = $DB_site->query_first("
SELECT thumb FROM " . TABLE_PREFIX ."vbgarage_images WHERE name = 'noimage' LIMIT 1
");
$thumb = @imagecreatefromstring($imagee['thumb']);
unset($imagee);
imagejpeg($thumb,'',75);
// clean up GD
imagedestroy ($thumb);
exit;
}
}
if( $vbg_use_fs )
{
// get thumbimage name from DB
$image = $DB_site->query_first("
SELECT name FROM " . TABLE_PREFIX ."vbgarage_images WHERE vbgarageid = $id LIMIT 1
");
if( !$image )
{
eval (print_standard_error('error_requiredfields'));
}
// create thumb name
$vbg_thumb = $vbg_path . "t" . $id . ".jpg";
// get image from filesystem
if(file_exists($vbg_thumb) && filesize($vbg_thumb))
{
$vbg_handle = fopen($vbg_thumb, 'rb');
if($vbg_handle)
{
$image['thumb'] = fread($vbg_handle, filesize( $vbg_thumb ));
@fclose($vbg_handle);
}
}
else
{
// need image error message here
echo "Bad Thumb File!";
exit;
}
}
// end filesystem hack
// use GD to display image
$thumb = @imagecreatefromstring($image['thumb']);
if( !$thumb )
{
// need bad image create message here
echo "Unable to create thumb!";
exit;
}
unset($image);
imagejpeg($thumb,'',75);
// clean up GD
imagedestroy ($thumb);
}
// END OPAQUE