]> _ Git - fluidbook-v3.git/commitdiff
Fix #594 @0.75
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 4 Aug 2016 14:08:19 +0000 (14:08 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 4 Aug 2016 14:08:19 +0000 (14:08 +0000)
framework/application/views/helpers/ExemplePublication.php

index d917485ceeee506704537d201b1db4b444e9fe22..22252d4a9899027695dfd15bd6a86a3cdf0625f8 100644 (file)
@@ -20,7 +20,12 @@ class Fluidbook_View_Helper_ExemplePublication extends CubeIT_View_Helper_Abstra
                $left = $this->_getPage($fluidbook_id, $page);\r
                $right = $this->_getPage($fluidbook_id, $page + 1);\r
 \r
-               $ratio = $left['width'] / $left['height'];\r
+        // Sometimes a page might not return a valid size (eg. Page 0 with no graphic)\r
+        // If the left page doesn't work, use the right page\r
+        $width = ($left['width'] == -1) ? $right['width'] : $left['width'];\r
+        $height = ($left['height'] == -1) ? $right['height'] : $left['height'];\r
+\r
+               $ratio = $width / $height;\r
 \r
                $backgrounds = array();\r
                //              $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '100% 10%', 'position' => '0 95%', 'blendmode' => null);\r
@@ -49,7 +54,11 @@ class Fluidbook_View_Helper_ExemplePublication extends CubeIT_View_Helper_Abstra
 \r
                $res .= '}';\r
                $res .= '</style>';\r
-               $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array('class' => 'exemple-fluidbook', 'id' => $cssid, 'data-width' => $left['width'] * 2, 'data-height' => $left['height']));\r
+               $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array(\r
+                   'class' => 'exemple-fluidbook',\r
+            'id' => $cssid,\r
+            'data-width' => $width * 2,\r
+            'data-height' => $height));\r
                return $res;\r
        }\r
 \r