PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Sep 29, 2020 3:04 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: crap quality
PostPosted: Tue Oct 25, 2005 9:45 am 
Offline
DevNet Master
User avatar

Joined: Tue Dec 28, 2004 6:57 pm
Posts: 2745
Location: Tallinn, Estonia
this thumbnail script is turning out images that seam to be missing bright colors. everything is dark and crappy even though i made imagejpeg at the highest quality

Syntax: [ Download ] [ Hide ]
function createThumb($image_path,$thumb_path,$image_name,$thumb_width = 100)

    {

        $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", 70);

        return true;

    }


what am i missing here?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 9:50 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India
two thing jump out at me :arrow:
Syntax: [ Download ] [ Hide ]
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));

and
Syntax: [ Download ] [ Hide ]
imagejpeg($dst_img, "$thumb_path/$image_name", 70);

first should be imagecopyresampled() and in second change 70 to 100.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 9:50 am 
Offline
Site Admin
User avatar

Joined: Tue Dec 23, 2003 3:10 am
Posts: 11470
Location: Toronto


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 2:08 pm 
Offline
Jedi Mod
User avatar

Joined: Tue Dec 21, 2004 6:03 pm
Posts: 5263
Location: usrlab.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 3:25 pm 
Offline
DevNet Master
User avatar

Joined: Tue Dec 28, 2004 6:57 pm
Posts: 2745
Location: Tallinn, Estonia
man you guys roxorz. imagecreatetruecolor worked like ultra good amazing. beers all around


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 4:52 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group