Re: image in memory to mySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
Hi:

I know how to upload an image from a file into a BLOB in mySQL, but how do you place an image that's in memory into mySQL?

For example, if I create an image via resampling another image or create a new image, how do I get that image into mySQL? I know I can save it as a file and load it back in again, but that's clumsy. I thought that I had the answer, but I can't find my code any longer -- arrgggh.

In any event, thanks for any suggestions.

tedd

Something like this?

<?php
$im = imagecreatefrompng("test.png");

ob_start();

imagepng($im);

$binary_image = ob_get_contents();

ob_end_clean();

insert into table(imagefield) values($binary_image);

?>

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux