R: [PHP-GENERAL] Creating an image and storing it as a GIF in a database

From: Date: Sat, 24 Jun 2000 17:07:29 +0000
Subject: R: [PHP-GENERAL] Creating an image and storing it as a GIF in a database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2921@lists.php.net to get a copy of this message
Hi Boaz, > Check out the various articles about pictures and mysql on > http://www.weberdev.com > in the articles section. > ... Tnx, but the articles on that site didn't help me much... The articles there simply describe how to include an image into a mysql table, supposing you have the image already stored in a file. That's ok, and that's what I've done untile now. But, I'd like to optimize it. ATM I do this: 1) Create my image with php functions [imagecreate() ,etc] 2) Draw some things into it 3) Output to gif file with imagegif() 4) open that file.gif 5) store the content of the file in a variable 6) store the content of the variable in the mysql table What I'd like to do is to "cut down" steps 3->6. Ideal task would be: 1) Create my image with php functions [imagecreate() ,etc] 2) Draw some things into it 3) Store the IMAGE IN GIF FORMAT into a variable 4) store the content of the variable in the mysql table As you can see, this would improve the speed of my script, and wouldn't need writing to disk the temporany file I have to create at the moment. Functions like image2gif(), image2jpeg(), image2png() would be needed. These would take the image handle as input, and return the image coded in gif/png/jpeg format, BUT NOT saved to disk. (IE simply stored in a var) > -----Original Message----- > From: Federico Pomi [mailto:Federico@Pomi.net] > Sent: Saturday, June 24, 2000 5:38 PM > To: php-general@lists.php.net > Subject: [PHP-GENERAL] Creating an image and storing it as a GIF in a > database > ... > I've an image I've createt with various image functions. > I need to save it in a database, in GIF format. > > How can I do it? > ATM the only way I've found is to output the image to a file, using > ImageGIF() function, then read the file and copy the content of that file in > my database. > Isn't there a faster way? It looks a bit stupid to save and reload and then > store... > > Isn't there a function that take an image handle and store it as a > GIF/JPEG/PNG into a variable?

« previous php.general (#2921) next »