$data = $prod_r["image"];
$fname = "/tmp/php/" . time();
$fp = fopen($fname, "w");
fwrite($fp, $data[$imgnum], strlen($data[$imgnum]));
fclose($fp);
$src_img = imagecreatefromjpeg($fname);
$new_w = 300;
$new_h = imagesy($src_img) / ( imagesx($src_img) / $new_w );
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img);
unlink($fname);
//--------
$prod_r["image"] is the data from a mysql db.
Everything works here, its just slow. I dont want to have to take the data, write it to a tempfile, just so that gd and open it, then I have to clean it up and delete it.
I can echo $data to the screen and its works great. just its not resized.
Is there anyway to take $data and let GD use it without writing it to a file. it seems backwards the way its being done right now.
Chris Lee