[fusion-commits] r2775 - sandbox/redline_advanced_stylization/widgets/QuickPlot

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Sep 9 22:00:44 PDT 2013


Author: jng
Date: 2013-09-09 22:00:44 -0700 (Mon, 09 Sep 2013)
New Revision: 2775

Modified:
   sandbox/redline_advanced_stylization/widgets/QuickPlot/GeneratePicture.php
Log:
Forward looking change to make QuickPlot compatible with PHP 5.5

Modified: sandbox/redline_advanced_stylization/widgets/QuickPlot/GeneratePicture.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/QuickPlot/GeneratePicture.php	2013-09-04 14:06:02 UTC (rev 2774)
+++ sandbox/redline_advanced_stylization/widgets/QuickPlot/GeneratePicture.php	2013-09-10 05:00:44 UTC (rev 2775)
@@ -168,9 +168,21 @@
         
         // Load the north arrow image which has a 300 dpi resolution
         $na         = imagecreatefrompng("./north_arrow.png");
+        
+        $transparent= imagecolortransparent($na);
+        // PHP 5.5 broke image rotation (or maybe we did it completely wrong before PHP 5.5). 
+        // Either way, here's how we fix it. Assign an explicit color if imagecolortransparent() returns -1
+        if ($transparent < 0) {
+            $transparent = imagecolorallocatealpha($na, 0, 0, 0, 127);
+            $bReleaseTrans = true;
+        }
+        
         // Rotate the north arrow according to the capture rotation
-        $transparent= imagecolortransparent($na);
         $rotatedNa  = imagerotate($na, -$rotation, $transparent);
+        // Free the transparent color if we allocated it
+        if ($bReleaseTrans)
+            imagecolordeallocate($na, $transparent);
+            
         // Free the north arrow image
         imagedestroy($na);
         // Get the size of north arrow image



More information about the fusion-commits mailing list