Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Making Thumbnails

    Hi Guys,

    i know how to move and upload photos great, but im not sure how to create a thumbnail say 100x100 of the same photo, i have checked a few tutorials out nothin i can get to grips with, can anyone give some advice or help on this.

    thanks guys

    Graham

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    search this forum, answered 100's of times
    http://www.codingforums.com/search.php

  • #3
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    Yep, this is a common requirement!

    Check out the PHP image functions: http://uk3.php.net/manual/en/ref.image.php

    And this one in particular:
    http://uk3.php.net/manual/en/functio...yresampled.php (Big hint ... use this function! ).

    Note that you need to have the GD library compiled with your PHP build and that not all these functions will work with verisons of the library prior to GD 2.0. (Infact the earlier versions of GD are pretty clunky, IMHO).

  • #4
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    You can not say you know how to do something, until you can teach it to someone else.

  • #5
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi Guys,

    Thanks a lot for the input, can i ask does it need to be done with the GD library, is there no way to do it with just php?

    thanks guys

    Graham

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,549
    Thanks
    8
    Thanked 1,095 Times in 1,086 Posts
    With anything other than GD or Imagemagick, you're stuck with
    resizing the appearance of an image on the browser, not the actual image itself ...
    so the answer to your question is you can't change an image size with PHP alone.

    Graham ... give us a link to one of your images and we can show you an easy
    PHP/GD example of resizing it to an actual .jpg thumb.

  • #7
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi MLSEIM,

    here we go heres an image:

    http://www.clan-apathy.net/Scottpolaroidgif.gif

    thanks for the help mate

    Graham

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,549
    Thanks
    8
    Thanked 1,095 Times in 1,086 Posts
    Here's my test page showing original, resized using PHP GD and the PHP script.

    http://www.catpin.com/scott.php

    (To use .jpg images, change all .gif references to .jpg)

    I got the script from this site ... you can see many other examples here:
    http://us2.php.net/manual/en/functio...yresampled.php


    EDIT:
    I didn't deal with the .gif transparent color. There is a way to find the current
    transparent color and transfer that to the thumbnail ... I just didn't take the time
    to learn how to do that yet.

    Here's the scoop on transparency colors:
    http://us2.php.net/manual/en/functio...ransparent.php



    .
    Last edited by mlseim; 07-23-2007 at 09:23 PM.

  • #9
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi Mate,

    thanks a lot for that i understand it a lot better now

    cheers

    Graham


  •  

    Posting Permissions

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