nudave04
06-29-2006, 09:32 AM
Hi,
I'm trying to generate thumbnails for images I upload to my site and save them to a mysql database (I'd rather do this than create new files.) Unfortunately, most of the tutorials out there on saving to BLOB deal with files uploaded from the user, where the raw contents of the file can be gotten by file_get_contents().
So, I have a function to generate the thumbnail that ends with:
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
This creates a resource $image_p that contains my thumbnail.
I know that a few lines from now, I need to have the line
$sql = "UPDATE `photos` set `thumbnail` = '$content' WHERE `ID` = '$ID'";
My question is what code I need to get the content of $image_p saved as $content in appropriate form to be stored in a blob.
Thanks!
I'm trying to generate thumbnails for images I upload to my site and save them to a mysql database (I'd rather do this than create new files.) Unfortunately, most of the tutorials out there on saving to BLOB deal with files uploaded from the user, where the raw contents of the file can be gotten by file_get_contents().
So, I have a function to generate the thumbnail that ends with:
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
This creates a resource $image_p that contains my thumbnail.
I know that a few lines from now, I need to have the line
$sql = "UPDATE `photos` set `thumbnail` = '$content' WHERE `ID` = '$ID'";
My question is what code I need to get the content of $image_p saved as $content in appropriate form to be stored in a blob.
Thanks!