Image resizing

This is a discussion on Image resizing within the Linux Programming forums, part of the Platform Specific Boards category; Hi! i hjave a little maths problem. I need to write a sript in PHP that allows users to upload ...

  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,825
    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, 05:17 AM
  2. image resizing algorithms.....
    By bhupesh.kec in forum C Programming
    Replies: 4
    Last Post: 09-18-2008, 02:20 PM
  3. [C++/WinAPI] Resizing image
    By jagi in forum Windows Programming
    Replies: 2
    Last Post: 04-04-2005, 08:44 AM
  4. image resizing
    By eth0 in forum C++ Programming
    Replies: 2
    Last Post: 09-15-2004, 02: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, 02:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21