I am currently working on a gallery project.
I have written code to store clients photos in a Mysql database, which is all working okay. I want to create a thumbnail on the fly which I do with the following code :-
$thumb_image_name= "t_" . $original_image_name;
$scaling_width=$original_image_width / $def_thumb_width;
$scaling_height=$original_image_height / $def_thumb_height;
if ($scaling_width > $scaling_height)
$thumb_width=$original_image_width / $scaling_width;
$thumb_height=$original_image_height / $scaling_width;
$thumb_width=$original_image_width / $scaling_height;
$thumb_height=$original_image_height / $scaling_height;
I have used fopen to open the original file in order to get the binary for the file. To prevent writing the data out to a file and reading it back again, I need to gain access to the data. $thumb will contain the image resource, and ImageJPEG($thumb) will output the data to the screen but I want it sent to my database instead.
In short how do I access data pointed to by a resource id.