Jump to content

Thumbnail


Morsusy2k

Recommended Posts

Hi,

I am having trouble with creating thumbnails of the pictures uploaded on my website.

This script on the first sight works perfectly but when I opened some of the files,some were ok but some lost too much of their color and become almost white,some almost black,others lost quality (on some you can't even say what is on them)..etc..

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; } 

Is there any way to do this in function like this but better working?

 

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...