How to create thumbnails ( Logic ) in PHP

How to create thumbnails ( Logic )

Scan a folder for JPG and PNG files (gd does not support GIF anymore, because the packing algorithm in GIF is copyrighted ).
Take each of these images, and load it.
Resize the image.
Save the image as a thumbnail.
The resizing idea is the following:

We assume the thumbnail should be 100 pixels, either wide or high.
We load the original image, and check its dimensions.
If the picture is higher than wide, we set the height of the thumb to 100 pixels.
The width of the thumbnail is the original width multiplied with 100 pixels divided by its height.
Thumbnail height = original width * (100 / original height)
This way we preserve the original aspect ratio.
If the original picture is wider than high, we do the same to the height of the thumbnail.
If they are the same, we simply create a 100×100 pixels image.
Back to table of contents
The PHP functions to use
PHP has a whole lot of functions to help us with generating graphics with gd.

For The example with php try this link
http://icant.co.uk/articles/phpthumbnails/
best of luck

About

me : yeay its me arun

Tagged with: , , ,
Posted in Misk

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>