Example #1
0
 function fetchElement()
 {
     $html = N2Html::tag('div', array('class' => 'n2-form-element-text n2-form-element-icon n2-border-radius'), N2Html::image(N2Image::base64Transparent(), '', array('class' => 'n2-form-element-preview')) . '<a id="' . $this->_id . '_edit" class="n2-form-element-button n2-h5 n2-uc" href="#">' . n2_('Choose') . '</a>' . parent::fetchElement());
     N2JS::addInline('
         new NextendElementIconManager("' . $this->_id . '");
     ');
     return $html;
 }
 protected static function optimizeImage($image, $data, $slider)
 {
     $lazyLoad = $slider->features->lazyLoad;
     $imagePath = N2ImageHelper::fixed($image, true);
     if ($imagePath[0] == '/' && $imagePath[1] != '/' && $lazyLoad->layerImageSizeBase64 && $lazyLoad->layerImageSizeBase64Size && filesize($imagePath) < $lazyLoad->layerImageSizeBase64Size) {
         return array('src' => N2Image::base64($imagePath, $image));
     }
     if (!$lazyLoad->layerImageOptimize || !$data->get('image-optimize', 1)) {
         return array('src' => N2ImageHelper::fixed($image));
     }
     $tablet = N2Image::scaleImage('image', $image, $lazyLoad->layerImageTablet);
     $mobile = N2Image::scaleImage('image', $image, $lazyLoad->layerImageMobile);
     if ($image == $tablet && $image == $mobile) {
         return array('src' => N2ImageHelper::fixed($image));
     }
     return array('src' => N2Image::base64Transparent(), 'data-desktop' => N2ImageHelper::fixed($image), 'data-tablet' => N2ImageHelper::fixed($tablet), 'data-mobile' => N2ImageHelper::fixed($mobile), 'data-device' => '1');
 }
 private function getDefaultImage($src, $deviceAttributes)
 {
     if (count($deviceAttributes) > 2 || $this->slider->features->lazyLoad->isEnabled > 0) {
         return N2Image::base64Transparent();
     } else {
         return N2ImageHelper::fixed($src);
     }
 }