Results 1 to 2 of 2

Thread: How to resize an image to fit in a desired space.

  1. #1
    Join Date
    Dec 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to resize an image to fit in a desired space.

    With this script you can upload images
    gif,jpg,bmp.
    In the submit form you can provide
    the max height and max width needed.

    After submitting the uploaded image
    file will be resized to the new
    max height and max width provided.

    On the http://www.get-on-top.com/image_resize/resize.php
    you can find the Example form
    you can also find the php code for the script.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This may help, as may other examples on the page:
    http://www.php.net/manual/en/functio...ized.php#61962

    The question is how you want to deal with the width/height: Is the height the max? The width? Whichever is smaller? Larger? Doing some simple tests of $w>$h, etc will determine that, then you just need to decide what to do. Usually, it makes sense to find which is larger, then make the image that dimension at 100px (or whatever limit you choose), and have the other scaled smaller, relatively.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •