RE: [PHP] resize a blob image?????

From: Date: Tue, 29 Aug 2000 21:06:34 +0000
Subject: RE: [PHP] resize a blob image?????
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14240@lists.php.net to get a copy of this message
On Tue, 29 Aug 2000, James Moore wrote: > > A dirty hack on this could be to create the image file from the blob, and > > then get the dimensions using getimagesize(). Then you can show the image > > and change your IMG tags. > > > > For this I will persume that the image data is in $img_data, it also reqires > gd. > > ==== UNTESTED CODE ========= > /* Create Temp File Name */ > $filename = $tmpnam($TMP_DIR,"img"); > > /* Create temp file */ > $fp = fopen($filename,"r"); > > /* Write out data */ > fwrite($fp,$img_data); > > fclose($fp); > > $image_atts = getimagesize($filename); > > $x_size = $image_atts[0]; > $y_size = $image_atts[1]; > Up until here it's exactly what I was thinking, but creating the image file itself thru GD is not needed IMO. I guess Ramiro just wants to know the dimensions of the image data so he can resize it correctly, like 30% smaller or something like this. Since I assumed that he wanted to resize the images like this, he needed to get an actual file and then use getimagesize() on it. After he gets the dimensions and do his proper calculations, he can use <img width="boo" height="boo"> to resize the image, while still using the same binary data from the database. That's why I told him it was a dirty hack. I guess I didn't explain myself very well on that one, but oh well :) Regards, Joao -- Joao Prado Maia Web Developer Kefta.com, Inc

« previous php.general (#14240) next »