graham23s
07-23-2007, 01:29 PM
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
rafiki
07-23-2007, 01:43 PM
search this forum, answered 100's of times :D
http://www.codingforums.com/search.php
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/function.imagecopyresampled.php (Big hint ... use this function! :D ).
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).
timgolding
07-23-2007, 02:30 PM
look at this post
http://www.codingforums.com/showthread.php?t=117852
graham23s
07-23-2007, 06:06 PM
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
mlseim
07-23-2007, 06:17 PM
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.
graham23s
07-23-2007, 07:28 PM
Hi MLSEIM,
here we go heres an image:
http://www.clan-apathy.net/Scottpolaroidgif.gif
thanks for the help mate
Graham
mlseim
07-23-2007, 08:02 PM
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/function.imagecopyresampled.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/function.imagecolortransparent.php
.
graham23s
07-23-2007, 09:02 PM
Hi Mate,
thanks a lot for that i understand it a lot better now:)
cheers
Graham