note 35481 added to ref.image
| From: | pigmeu at rack1 dot php dot net | Date: | Tue, 02 Sep 2003 17:09:57 +0000 |
| Subject: | note 35481 added to ref.image | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55484@lists.php.net to get a copy of this message | ||
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);
//...
----
Manual Page -- http://www.php.net/manual/en/ref.image.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35481
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35481&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35481&report=yes