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:

// 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 > 

// Write thumbprint
$fd = fopen( "$File.tmb", "r+");
$tmb = addslashes(fread($fd, filesize("$File.tmb")));

// 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..


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]

Reply via email to