943,519 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 446
  • PHP RSS
Nov 26th, 2008
0

problem with gd

Expand Post »
hi all
i problem rotate image (png)
code :
PHP Syntax (Toggle Plain Text)
  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);
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Coward is offline Offline
11 posts
since Aug 2008
Nov 26th, 2008
0

Re: problem with gd

Click to Expand / Collapse  Quote originally posted by Coward ...
....
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Why is PHP good for making a website?
Next Thread in PHP Forum Timeline: Is Online chatting done with php?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC