|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2003-01-06 14:14 UTC] gid at gifpaste dot net
 http://www.boutell.com/gd/ has a patch against php 4.2.3 that adds the imagecopyrotated() function from the gdImageCopyRotated() function that was added in gd 2.0.8. I would be nice if this were a part of the php tree. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
In my opinion, it wouldn't make sense to implement imagecopyrotated() in ext/gd, because it's not hard to implement it in userland using imagerotate() which produces results of far better quality than gdImageCopyRotated(). > […] ImageRotate fills the background with a given color -- > ImageCopyRotated will let the destination image show through the > transparent portions of the source, if any. You can choose a transparent color when using imagerotate() to achieve the same result. An example: <?php // red background $back = imagecreatetruecolor(150, 150); imagefilledrectangle($back, 0, 0, 149, 149, 0xff0000); // green foreground $front = imagecreatetruecolor(100, 100); imagefilledrectangle($front, 0, 0, 99, 99, 0x00ff00); // rotate foreground with transparent filling of missing pixels $front = imagerotate($front, 45, 0x7f000000); // copy foreground onto background imagecopy($back, $front, 5, 5, 0, 0, imagesx($front), imagesy($front)); // save composition: green diamond on red background imagepng($back, __DIR__ . '/21470.png');