Jason-- There are many reasons I don't quite recommend creating the thumbnails on the fly with ImageMagick: 1) I've heard many say that storing/retrieving images from MySQL databases isn't the greatest idea, because you end up with -huge- tables, which leads to long query times. 2) Resizing a JPEG on the fly is a very CPU intensive task 3) Calling the shell, then calling the ImageMagick program is more and more overhead. If you insist on storing the images in the database, then you're best off storing the thumbnails in there too. If you insist on creating thumbnails on the fly, then I suggest you install PHP 4.0.6 with GD 2.0.1 and use ImageCopyResampled() or ImageCopyResized() to do it-- it'll save you from spawning a shell and running an external program. I had to create a Real Estate site, where house listings could be posted with photos to accompany them... When a photo was uploaded (HTTP upload), the script would use ImageCreateTrueColor() to create two new images, then I called ImageCopyResampled() to resize the image to two different sizes-- one thumbnail for search results, then a larger one for listing details. I stored these images in a directory in the format: /images/1_thumb.jpg /images/1_full.jpg And so on... The number (1 in this case) corresponded with the auto_increment ID of the MySQL record for the item. When the listing is deleted, PHP deletes the associated images automatically (if they exist). Good luck! -----Original Message----- From: Jason Bell [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 7:27 PM To: [EMAIL PROTECTED] Subject: [PHP] Thumbnail Generation from DB Stored Images. Hello! I have images stored in a MySQL Database. I can retrieve the images and display them without a problem, but I'd really like to be able to create thumbnails. The code that I've written just doesn't seem to work. Preferably, I'd like to pull the image from the database, and create the thumbnail for display, without ever writing an image to the disk. If this is not possible, I'd like to know alternate methods. I'm using imagemagick's convert utility to create the thumbs. Here is my code: getpic.php: <?php if($id) { @MYSQL_CONNECT("localhost","username","mypassword"); @mysql_select_db("daelic"); $query = "select image,type from images where id=$id"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image"); $type = @MYSQL_RESULT($result,0,"type"); Header( "Content-type: $type"); echo $data; }; ?> tgen.php: <?php if ($id) { $src = getpic.php?id=$id; $thumb = passthru("convert -geometry 40% $src jpeg:-"); print $thumb; }; ?> I know that getpic.php works. I can use it in like this: echo "<IMG SRC='getpic.php?id=$id'>"; and it will output the fullsize graphic in place. I'm trying to get to a point where I can use tgen.php in the same mannor. I can use the same convert command if I use an actual file, like pics/mypic.jpg and it works, so the command is good..... any help at all would be very appreciated, Jason Bell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]