Image question
| From: | Ed Lazor | Date: | Wed, 15 Sep 2004 00:05:52 +0000 |
| Subject: | Image question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196671@lists.php.net to get a copy of this message | ||
PHP's creating an image and I'm trying to store it into MySQL. Instead of
raw binary data, all I'm getting is a resource reference. To test this and
keep things as simple as possible, I took and created an image with
createimagefromjpeg. Here's some example code of what I'm talking about:
$url = "http://mysite.com/picture.jpg";
$im = imagecreatefromjpeg($url);
Imagejpeg($im); // successfully displays image
I'm assuming that $im contains the binary data for the picture and I'd
expect to get raw binary output from:
echo $im;
But I don't... I get "reference #22" instead.
How would I go about accessing the raw data in order to store it into the
database successfully? Do I need to know anything special about pulling it
back out and storing it in a variable?
Side note: I know that storing images in a database isn't generally
optimal. I've chosen this route because performance isn't an issue and ease
of tracking tens of thousands of images is important.
Thanks,
Ed