Re: [PHP] Generate Thumbnail gif's
Is there any pre-written code available on the net to generate thumbnail images for a picture. I mean I send the path of the image and my PHP Script should be able to generate a gif file of size 100x71 or something like that. If your server has Imagemagick installed (it seems pretty common), try: `convert -size 100x71 old.gif new.gif`; That will scale your image into 100x71 pixels, and will maintain the aspect ratio. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Generate Thumbnail gif's
Dear all, Is there any pre-written code available on the net to generate thumbnail images for a picture. I mean I send the path of the image and my PHP Script should be able to generate a gif file of size 100x71 or something like that. Thanks Regards, ___ PHPLover * : [EMAIL PROTECTED] Göd döësn't pläy dícë. - Älbërt Ëínstëín ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **
Re: [PHP] Generate Thumbnail gif's
Vijaya_Manda wrote: Is there any pre-written code available on the net to generate thumbnail images for a picture. I mean I send the path of the image and my PHP Script should be able to generate a gif file of size 100x71 or something like that. Images will look stretched if you do that, but here are two functions to resize an image with a new width or height proportional to its current size. Pass them GD image resources created with imagecreatefrompng() and friends. function imageresizeheight($img, $newheight) { $oldheight = imagesy($img); $oldwidth = imagesx($img); $newwidth = $oldwidth * ($newheight / $oldheight); $newimg = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($newimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $oldwidth, $oldheight); return $newimg; } function imageresizewidth($img, $newwidth) { $oldheight = imagesy($img); $oldwidth = imagesx($img); $newheight = $oldheight * ($newwidth / $oldwidth); $newimg = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($newimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $oldwidth, $oldheight); return $newimg; } -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generate Thumbnail gif's
Vijay Killu wrote: That will resize the image and display it as a thumbnail. No, they will give you a GD image resource to do what you want with. What I want is a new image to be created. I mean a .gif file. You can't create a GIF, but you can use imagepng() or imagejpeg() to output it to a file as a PNG or JPEG. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generate Thumbnail gif's
* Thus wrote Leif K-Brooks ([EMAIL PROTECTED]): Vijaya_Manda wrote: Is there any pre-written code available on the net to generate thumbnail images for a picture. I mean I send the path of the image and my PHP Script should be able to generate a gif file of size 100x71 or something like that. Images will look stretched if you do that, but here are two functions to resize an image with a new width or height proportional to its current size. Pass them GD image resources created with imagecreatefrompng() and friends. you could center a proportinal image onto a 100x71 background image. if (width height) { resize width to 100 resize height = height / (int) width/100 } else { resize height to 71 resize width = width / (int) height/71 } put resized image in center of 100x71 image. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php