FLY TO THE ZENITH OF SUCCESS

Arun Raj.R (Software Engineer)

How to create thumbnails ( Logic )

, , , , , , ,

How to create thumbnails
To generate thumbnails we do the following:

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 100x100 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

Java Interview Questions UpdatedHow to install /configure GD library for PHP 5 on appache / windows xp ?

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

February 2012
M T W T F S S
January 2012March 2012
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29