problem with gd

Reply

Join Date: Aug 2008
Posts: 11
Reputation: Coward is an unknown quantity at this point 
Solved Threads: 0
Coward's Avatar
Coward Coward is offline Offline
Newbie Poster

problem with gd

 
0
  #1
Nov 26th, 2008
hi all
i problem rotate image (png)
code :
  1. $myimage=imagecreatefromjpeg('test.jpg');
  2. $mypng=imagecreatefrompng('opera.png');
  3. $sizepng= getimagesize('opera.png');
  4.  
  5. $jpgwidth=imagesx($myimage);
  6. $jpghieght=imagesy($myimage);
  7. $pngwidth=imagesx($mypng);
  8. $pnghieght=imagesy($mypng);
  9. $pngwidth1=$sizepng[0] / 10;
  10. $pnghieght1=$sizepng[1] / 10;
  11.  
  12. imagerotate(mypng,50,1);
  13. imagecopyresized($myimage,$mypng,0,0,0,0,$pngwidth1,$pnghieght1,$sizepng[0],$sizepng[1]);
  14. header("Contents-type: image/jpeg");
  15. imagejpeg($myimage);
  16. imagedestroy($myimage);
  17. imagedestroy ($mypng);
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 232
Reputation: Rhyan is an unknown quantity at this point 
Solved Threads: 24
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Posting Whiz in Training

Re: problem with gd

 
0
  #2
Nov 26th, 2008
Originally Posted by Coward View Post
....
  1. imagerotate(mypng,50,1);
  2. imagecopyresized($myimage,$mypng,0,0,0,0,$pngwidth1,$pnghieght1,$sizepng[0],$sizepng[1]);
  3. header("Contents-type: image/jpeg");
  4. imagejpeg($myimage);
  5. imagedestroy($myimage);
  6. imagedestroy ($mypng);
You are trying to create a JPG from PNG. I don't think that GD allows this. Therefore you should use createimagefrompng() and imagecopyresampled(). Also, header(content....) should be PNG, not JPG.
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC