$image_ratio = $image_height / $image_width;\r
$attributes['data-bg-ratio'] = $image_ratio;\r
\r
- $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $image_width * 0.55, $image_height, array(), 'C', 'R', 'M');\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
+ //$mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $image_width * 0.55, $image_height, array(), 'C', 'R', 'M');\r
+ $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M');\r
\r
- $bg = $this->htmlElement($this->picture(array(array('src' => $image_path, "width" => 1680), array("src" => $mobile, "width" => 1680, 'media' => '(max-width: 900px)'))), 'div', array('class' => 'picture'));\r
+ $bg = $this->htmlElement($this->picture([\r
+ [\r
+ 'src' => $image_path,\r
+ 'width' => 1680\r
+ ],\r
+ [\r
+ 'src' => $mobile,\r
+ 'width' => 900,\r
+ 'media' => '(max-width: 900px)'\r
+ ]\r
+ ]), 'div', array('class' => 'picture'));\r
$content = $bg . $content;\r
}\r
}\r