note 35481 deleted from ref.image by tularis
| From: | tularis@php.net | Date: | Sun, 29 Jun 2008 21:11:57 +0000 |
| Subject: | note 35481 deleted from ref.image by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140976@lists.php.net to get a copy of this message | ||
Note Submitter: pigmeu at pigmeu dot net
----
I had some troubles when trying to resize an image gotten from a database blob field... Perhaps that
these image functions don't work with opened image streams...
So, I had to make this workaround...
Use this code if you are trying to handle imagens from a database.
//...
// creating a temp image name
$t_img_name = tempnam ("/tmp", "timg");
$t_img = fopen($t_img_name, "w");
// $content is the blob field with the image.
fwrite($t_img, $content);
fclose($t_img);
// now, do what want to with the image
$size = getimagesize($t_img_name);
echo $size[0]." - ".$size[1];
// don't forget to delete the temp file after all.
unlink($t_img_name);
//...