Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.
Index: lib/phpthumb/phpthumb.class.php
===================================================================
--- lib/phpthumb/phpthumb.class.php (revision 32)
+++ lib/phpthumb/phpthumb.class.php (revision 33)
@@ -44,7 +44,7 @@
var $err = null; // default ERRor image filename
var $xto = null; // extract eXif Thumbnail Only
var $ra = null; // Rotate by Angle
- var $ar = null; // Auto Rotate
+ var $ar = 'x'; // Auto Rotate
var $aoe = null; // Allow Output Enlargement
var $far = null; // Fixed Aspect Ratio
var $iar = null; // Ignore Aspect Ratio
@@ -928,8 +928,53 @@
function Rotate() {
if ($this->ra || $this->ar) {
if (!function_exists('ImageRotate')) {
- $this->DebugMessage('!function_exists(ImageRotate)', __FILE__, __LINE__);
- return false;
+ // Code by Dominik Scholz: http://php.net/manual/en/function.imagerotate.php#82261
+ function imagerotate($src_img, $angle)
+ {
+ $src_x = imagesx($src_img);
+ $src_y = imagesy($src_img);
+ if ($angle == 180)
+ {
+ $dest_x = $src_x;
+ $dest_y = $src_y;
+ }
+ elseif (($angle == 90) || ($angle == 270))
+ {
+ $dest_x = $src_y;
+ $dest_y = $src_x;
+ }
+ else
+ {
+ return $src_img;
+ }
+
+ $rotate=imagecreatetruecolor($dest_x,$dest_y);
+ imagealphablending($rotate, false);
+
+ switch ($angle)
+ {
+ case 270:
+ $dest_x--;
+ for ($y = 0; $y < $src_y; $y++)
+ for ($x = 0; $x < $src_x; $x++)
+ imagesetpixel($rotate, $dest_x - $y, $x, imagecolorat($src_img, $x, $y));
+ break;
+ case 90:
+ $dest_y--;
+ for ($y = 0; $y < $src_y; $y++)
+ for ($x = 0; $x < $src_x; $x++)
+ imagesetpixel($rotate, $y, $dest_y - $x, imagecolorat($src_img, $x, $y));
+ break;
+ case 180:
+ $dest_x--;
+ $dest_y--;
+ for ($y = 0; $y < $src_y; $y++)
+ for ($x = 0; $x < $src_x; $x++)
+ imagesetpixel($rotate, $dest_x - $x, $dest_y - $y, imagecolorat($src_img, $x, $y));
+ break;
+ }
+ return $rotate;
+ }
}
if (!include_once(dirname(__FILE__).'/phpthumb.filters.php')) {
$this->DebugMessage('Error including "'.dirname(__FILE__).'/phpthumb.filters.php" which is required for applying filters ('.implode(';', $this->fltr).')', __FILE__, __LINE__);
@@ -2685,4 +2730,4 @@
}
1 to 7 of 7