From: vincent@cubedesigners.com Date: Wed, 29 Jan 2020 18:21:00 +0000 (+0000) Subject: wip #3375 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b403984318ba5dddd4c1ab42e176027ca00ac636;p=fluidbook-v3.git wip #3375 @3 --- diff --git a/framework/application/views/helpers/BackgroundBlock.php b/framework/application/views/helpers/BackgroundBlock.php index 78e49a2..cc38ba0 100644 --- a/framework/application/views/helpers/BackgroundBlock.php +++ b/framework/application/views/helpers/BackgroundBlock.php @@ -17,6 +17,7 @@ class Fluidbook_View_Helper_BackgroundBlock extends CubeIT_View_Helper_Abstract $data['bg_color'] = $data['backgroundcolor']; } if (isset($data['bg_image'])) { + $bgimage = CubeIT_Util_Cms::extractFile($data['bg_image']); $extra_attributes = array(); if ($bgimage) { @@ -33,40 +34,47 @@ class Fluidbook_View_Helper_BackgroundBlock extends CubeIT_View_Helper_Abstract // Scale image, factoring in crop that will take place... // Image will be cropped to 900px wide so ensure that we have 45% extra and then determine the target height $target_height = ($mobile_max_width / 0.55) * $image_ratio; - //$mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $image_width * 0.55, $image_height, array(), 'C', 'R', 'M'); - if (isset($data['backgroundmobileimage'])) { - $bgmobileimage = CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']); - if ($bgmobileimage) { - $attributes['data-has-mobile']='1'; - $mobile_path = CubeIT_View_Helper_ImageCms::getPath($bgmobileimage); - CubeIT_Image::getDimensions($mobile_path, $image_width, $image_height); - $image_ratio = $image_height / $image_width; - $attributes['data-mobile-ratio'] = $image_ratio; - $target_height = $mobile_max_width * $image_ratio; - $mobile = $this->imageProcess()->imageProcessGetURL($mobile_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); - }else{ + + if (stripos($image_path, '.oam') !== false) { + $pict = $this->view->imageCms($image_path); + } else { + if (isset($data['backgroundmobileimage'])) { + $bgmobileimage = CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']); + if ($bgmobileimage) { + $attributes['data-has-mobile'] = '1'; + $mobile_path = CubeIT_View_Helper_ImageCms::getPath($bgmobileimage); + CubeIT_Image::getDimensions($mobile_path, $image_width, $image_height); + $image_ratio = $image_height / $image_width; + $attributes['data-mobile-ratio'] = $image_ratio; + $target_height = $mobile_max_width * $image_ratio; + $mobile = $this->imageProcess()->imageProcessGetURL($mobile_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + } else { + $attributes['data-bg-ratio'] = $attributes['data-bg-ratio']; + $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + } + } else { $attributes['data-bg-ratio'] = $attributes['data-bg-ratio']; $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); } - } else { - $attributes['data-bg-ratio'] = $attributes['data-bg-ratio']; - $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); - } - $bg = $this->htmlElement($this->picture([ - [ - 'src' => $image_path, - 'width' => 1920 + $pict = $this->picture([ + [ + 'src' => $image_path, + 'width' => 1920 + ], + [ + 'src' => $mobile, + 'width' => $mobile_max_width, + 'media' => '(max-width: 900px)' + ] ], - [ - 'src' => $mobile, - 'width' => $mobile_max_width, - 'media' => '(max-width: 900px)' - ] - ], - [ - 'alt' => $data['title'] - ]), 'div', array('class' => 'picture')); + [ + 'alt' => $data['title'] + ]); + + + } + $bg = $this->htmlElement($pict, 'div', array('class' => 'picture')); $content = $bg . $content; } } diff --git a/less/002-common.less b/less/002-common.less index 0030995..3d53584 100644 --- a/less/002-common.less +++ b/less/002-common.less @@ -140,6 +140,7 @@ a { height: 1000px; z-index: 0; + picture { img { width: 100%; @@ -150,6 +151,12 @@ a { bottom: 0; } } + + iframe{ + //right: 0; + //bottom: 0; + //position: absolute; + } } .grid {