Making thumbnails in PHP

Reply

Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

Making thumbnails in PHP

 
0
  #1
Oct 7th, 2006
Hello,

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

Wots the code for it?


Thanx in advance
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 204
Reputation: pcschrottie is an unknown quantity at this point 
Solved Threads: 8
pcschrottie's Avatar
pcschrottie pcschrottie is offline Offline
Posting Whiz in Training

Re: Making thumbnails in PHP

 
0
  #2
Oct 7th, 2006
Try something like this:

  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC