944,116 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1589
  • PHP RSS
Oct 7th, 2006
0

Making thumbnails in PHP

Expand Post »
Hello,

I want to convert a 1024 x 786 wallpaper into thumbnail in PHP

Wots the code for it?


Thanx in advance
Similar Threads
Reputation Points: 58
Solved Threads: 1
Posting Whiz in Training
cancer10 is offline Offline
234 posts
since Dec 2004
Oct 7th, 2006
0

Re: Making thumbnails in PHP

Try something like this:

PHP Syntax (Toggle Plain Text)
  1. $size = getimagesize ("path_to_original_image");
  2. $mini = imagecreatetruecolor(100,100);
  3. $orig = imagecreatefromjpeg ("path_to_original_image");
  4. imagecopyresampled ($mini, $orig, 0, 0, 0, 0, 100, 100, $size[0], $size[1]);
  5. imagejpeg ($mini, "path_to_thumbnail/thumbnail.jpg", 100);


This creates a 100x100 Pixel Thumbnail. Make sure, depending on your version of PHP, that the GD library is installed.


Michael
Reputation Points: 11
Solved Threads: 8
Posting Whiz in Training
pcschrottie is offline Offline
204 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: hello i need help please
Next Thread in PHP Forum Timeline: PHP includes & variables





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC