}\r
if (isset($data['bg_image'])) {\r
\r
- $bgimage = CubeIT_Util_Cms::extractFile($data['bg_image']);\r
$extra_attributes = array();\r
- if ($bgimage) {\r
- $image_path = CubeIT_View_Helper_ImageCms::getPath($bgimage);\r
+ $bg = '';\r
+ if ($data['bg_image']) {\r
+ foreach ($data['bg_image'] as $img) {\r
+ $bgimage = CubeIT_Util_Cms::extractFile($img);\r
+ $image_path = CubeIT_View_Helper_ImageCms::getPath($bgimage);\r
\r
- // Work out the ratio of the background image\r
- CubeIT_Image::getDimensions($image_path, $image_width, $image_height);\r
- $image_ratio = $image_height / $image_width;\r
- $attributes['data-bg-ratio'] = $image_ratio;\r
+ // Work out the ratio of the background image\r
+ CubeIT_Image::getDimensions($image_path, $image_width, $image_height);\r
+ $image_ratio = $image_height / $image_width;\r
+ $attributes['data-bg-ratio'] = $image_ratio;\r
\r
- // Create a cropped version of the image for mobile that cuts off the left 45% of the image\r
- // Make sure image is not wider than 900px when finished\r
- $mobile_max_width = 900;\r
- // Scale image, factoring in crop that will take place...\r
- // Image will be cropped to 900px wide so ensure that we have 45% extra and then determine the target height\r
- $target_height = ($mobile_max_width / 0.55) * $image_ratio;\r
+ // Create a cropped version of the image for mobile that cuts off the left 45% of the image\r
+ // Make sure image is not wider than 900px when finished\r
+ $mobile_max_width = 900;\r
+ // Scale image, factoring in crop that will take place...\r
+ // Image will be cropped to 900px wide so ensure that we have 45% extra and then determine the target height\r
+ $target_height = ($mobile_max_width / 0.55) * $image_ratio;\r
\r
- if (stripos($image_path, '.oam') !== false || stripos($image_path, '.zip') !== false) {\r
- if (!isset($data['backgroundmobileimage'])) {\r
- $pict = $this->view->imageCms($image_path);\r
+ if (stripos($image_path, '.oam') !== false || stripos($image_path, '.zip') !== false) {\r
+ if (!isset($data['backgroundmobileimage'])) {\r
+ $pict = $this->view->imageCms($image_path);\r
+ } else {\r
+ $pict = '<div class="desktopr">' . $this->view->imageCms($image_path) . '</div>';\r
+ $pict .= '<div class="mobiler">' . $this->view->imageCms(CubeIT_View_Helper_ImageCms::getPath(CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']))) . '</div>';\r
+ }\r
} else {\r
- $pict = '<div class="desktopr">' . $this->view->imageCms($image_path) . '</div>';\r
- $pict .= '<div class="mobiler">' . $this->view->imageCms(CubeIT_View_Helper_ImageCms::getPath(CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']))) . '</div>';\r
- }\r
- } else {\r
- if (isset($data['backgroundmobileimage'])) {\r
- $bgmobileimage = CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']);\r
- if ($bgmobileimage) {\r
- $attributes['data-has-mobile'] = '1';\r
- $mobile_path = CubeIT_View_Helper_ImageCms::getPath($bgmobileimage);\r
- CubeIT_Image::getDimensions($mobile_path, $image_width, $image_height);\r
- $image_ratio = $image_height / $image_width;\r
- $attributes['data-mobile-ratio'] = $image_ratio;\r
- $target_height = $mobile_max_width * $image_ratio;\r
- $mobile = $this->imageProcess()->imageProcessGetURL($mobile_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
+ if (isset($data['backgroundmobileimage'])) {\r
+ $bgmobileimage = CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']);\r
+ if ($bgmobileimage) {\r
+ $attributes['data-has-mobile'] = '1';\r
+ $mobile_path = CubeIT_View_Helper_ImageCms::getPath($bgmobileimage);\r
+ CubeIT_Image::getDimensions($mobile_path, $image_width, $image_height);\r
+ $image_ratio = $image_height / $image_width;\r
+ $attributes['data-mobile-ratio'] = $image_ratio;\r
+ $target_height = $mobile_max_width * $image_ratio;\r
+ $mobile = $this->imageProcess()->imageProcessGetURL($mobile_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
+ } else {\r
+ $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
+ }\r
} else {\r
$mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
}\r
- } else {\r
- $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
- }\r
\r
- $pict = $this->picture([\r
- [\r
- 'src' => $image_path,\r
- 'width' => 2560\r
+ $pict = $this->picture([\r
+ [\r
+ 'src' => $image_path,\r
+ 'width' => 2560\r
+ ],\r
+ [\r
+ 'src' => $mobile,\r
+ 'width' => $mobile_max_width,\r
+ 'media' => '(max-width: 900px)'\r
+ ]\r
],\r
- [\r
- 'src' => $mobile,\r
- 'width' => $mobile_max_width,\r
- 'media' => '(max-width: 900px)'\r
- ]\r
- ],\r
- [\r
- 'alt' => $data['title']\r
- ]);\r
-\r
-\r
+ [\r
+ 'alt' => $data['title']\r
+ ]);\r
+ }\r
+ $bg .= $this->htmlElement($pict, 'div', array('class' => 'picture'));\r
}\r
- $bg = $this->htmlElement($pict, 'div', array('class' => 'picture'));\r
$content = $bg . $content;\r
}\r
}\r