I'm confused. Is your problem serving up the images in your database to the web or writing them out to files on the server?
If it's serving images, I would expect you to have: select myimage from db Header("Content-type: image/jpeg"); echo $myrow[myimage]; exit(); etc. If it's writing from the db to a real file on your server, I would expect: select myimage from db open myfile write $myrow[myimage]; close myfile etc. The Header is just for the web, to tell the browser or other client what kind of file it is getting from your php script since it is not the expected type automatically supplied by the web-server (text/html). Real physical files don't need a header. The web servers automatically generate appropriate headers for real image files based on the file extension before they send them out over the web. Does that make sense, or have I completely missed the point? George Mike Gifford wrote: > > Hello, > > I've got a number of images in a database.. Ultimately what I would > like to do is be able to resize the image that is already in the > database and then insert that image into another field. > > Uploading the files generally inserts these both at the same time, > however I need to create a number of new thumbprints based on a > different scale. > > What I thought would be easiest would be to take the image, save it to > filename.jpg and then run the thumbnailing script on it. > > I think that this would look like the following: > > <?php > // There's other DB stuff here, but this isn't important > $Images = stripslashes($row[0]); > $File = "ReThumbnail.jpg"; > > // Create JPG image > ImageJPEG(imagecreatefromstring($Images), $File); > > // Scale image > system("djpeg -pnm $File | pnmscale -xscale .1 -yscale .1 | cjpeg > > $File.tmb"); > > // Write thumbprint > $fd = fopen( "$File.tmb", "r+"); > $tmb = addslashes(fread($fd, filesize("$File.tmb"))); > fclose($fd); > > // Insert Thumbprint image into database > $sql = "UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID"; > // There's other DB Stuff here too... > ?> > > I'm really quite stuch here.. > > How do you take a db image of a database and create a physical jpg file? > I think I'm getting messed up by the header in: > > Header("Content-type: image/jpeg"); > echo $Images; > > I can't figure out how to create the header. There's lots of examples > of how to do the above, but I have yet to stumble across an example > which allows you to write the header into a file.... > > Suggestions would be appreciated.. > > Mike -- 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]