[mapguide-commits] r7852 - sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Sep 9 21:52:58 PDT 2013


Author: jng
Date: 2013-09-09 21:52:58 -0700 (Mon, 09 Sep 2013)
New Revision: 7852

Modified:
   sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
Log:
PHP 5.5 breaks our QuickPlot (namely, rendering a north arrow breaks the whole image). This submission fixes that.

Modified: sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
===================================================================
--- sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php	2013-09-06 17:40:56 UTC (rev 7851)
+++ sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php	2013-09-10 04:52:58 UTC (rev 7852)
@@ -144,9 +144,21 @@
 
         // Load the north arrow image which has a 300 dpi resolution
         $na         = imagecreatefrompng("../viewerfiles/quickplotnortharrow.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 mapguide-commits mailing list