From 1d5e9d7f6aa37d05879159b93a8c0b89b2f7c30f Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Thu, 4 Aug 2016 14:08:19 +0000 Subject: [PATCH] Fix #594 @0.75 --- .../views/helpers/ExemplePublication.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/framework/application/views/helpers/ExemplePublication.php b/framework/application/views/helpers/ExemplePublication.php index d917485..22252d4 100644 --- a/framework/application/views/helpers/ExemplePublication.php +++ b/framework/application/views/helpers/ExemplePublication.php @@ -20,7 +20,12 @@ class Fluidbook_View_Helper_ExemplePublication extends CubeIT_View_Helper_Abstra $left = $this->_getPage($fluidbook_id, $page); $right = $this->_getPage($fluidbook_id, $page + 1); - $ratio = $left['width'] / $left['height']; + // Sometimes a page might not return a valid size (eg. Page 0 with no graphic) + // If the left page doesn't work, use the right page + $width = ($left['width'] == -1) ? $right['width'] : $left['width']; + $height = ($left['height'] == -1) ? $right['height'] : $left['height']; + + $ratio = $width / $height; $backgrounds = array(); // $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '100% 10%', 'position' => '0 95%', 'blendmode' => null); @@ -49,7 +54,11 @@ class Fluidbook_View_Helper_ExemplePublication extends CubeIT_View_Helper_Abstra $res .= '}'; $res .= ''; - $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'])); + $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array( + 'class' => 'exemple-fluidbook', + 'id' => $cssid, + 'data-width' => $width * 2, + 'data-height' => $height)); return $res; } -- 2.39.5