[ Home Home | Account | Shoping Shopping Cart (0) | Sitemap | Contact ]

[ Language ]

Frequently Asked Questions

PHP! Hypertext Preprocessor FAQ:

How can I create thumbnails using PHP?

// PHP Code
function thumbnail($image_path,$thumb_path,$image_name,$thumb_width)
{
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = $thumb_width;
$diff=$origw/$new_w;
$new_h=$new_w;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));

imagejpeg($dst_img, "$thumb_path/$image_name");
return true;
}


The above will create a hard copy of the JPG, make sure the output directory is writable by the webserver.




  • Red Hat
  • Microsoft
  • PHP
  • MYSQL
  • Macromedia
  • Google
  • 2Checkout

[ Site Map | Contact Us | XHTML | CSS ] ©1999-2008 Exiqze.com, US: +(1) 617-848-9286 - BG: +(359) 88-662-8148