Thread: Image resizing

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    29

    Image resizing

    Hi! i hjave a little maths problem.

    I need to write a sript in PHP that allows users to upload images files, then have them displayed in thumbnails. This is easy.
    However, i dont want the thumbnails to apear "squashed" or "stretched". This means i cant simply tell the image to be a certain size, not can i use a percentage. As some images will be bigger than others, this wouldn't work.

    The size of the thiumbnail should be aroun 80 x 80 ish. Any ideas? For the first person to tell me how to do this, i will provide free webhosting!!
    --Jock (Bristol Bound)
    http://www.termisoc.com
    http://case.termisoc.com

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Why can't you use a percent?

    If you have the pixel size of the original, fit the largest dimension to 80 pixels and adjust the other one by the same ratio.

  3. #3
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    Hi!

    take a look at the ImageMagicks "montage" manual page, which is included in all major linux distributions. It can generate a thumbnail-picture of a directory with only a single command. As you are making thumbnails for the web, you should probably not generate them on-the-fly, but only once, if you change the contents of the directory with the hi-res pictures.

    alex

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    29
    Thanks Alex. I'll have a look at that!!

    Free hosting comming your way i think!
    --Jock (Bristol Bound)
    http://www.termisoc.com
    http://case.termisoc.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. image resizing algorithms.....
    By bhupesh.kec in forum C Programming
    Replies: 4
    Last Post: 09-18-2008, 01:20 PM
  3. [C++/WinAPI] Resizing image
    By jagi in forum Windows Programming
    Replies: 2
    Last Post: 04-04-2005, 07:44 AM
  4. image resizing
    By eth0 in forum C++ Programming
    Replies: 2
    Last Post: 09-15-2004, 01:08 AM
  5. Resizing an Image to Cover Top
    By Speedy5 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 06-11-2003, 01:34 PM