Example #1
0
 function _render_html()
 {
     if ($this->_content['mediaId'] > 0) {
         $attributes = $this->_content;
         if (!is_null($this->getAttribute('width')) && !is_null($this->getAttribute('height'))) {
             if ($this->getAttribute('processThumbnail') != 'false') {
                 if ($this->getAttribute('processThumbnail') == 'full') {
                     $thumbnail = $this->media->getResizeImage($this->getAttribute('width'), $this->getAttribute('height'), $this->getAttribute('crop'), $this->getAttribute('cropOffset'));
                 } else {
                     $thumbnail = $this->media->getThumbnail($this->getAttribute('width'), $this->getAttribute('height'), $this->getAttribute('crop'), $this->getAttribute('cropOffset'));
                 }
                 $attributes['src'] = $thumbnail['fileName'];
                 $attributes['width'] = $thumbnail['width'];
                 $attributes['height'] = $thumbnail['height'];
                 $this->_content['src'] = $thumbnail['fileName'];
                 $this->_content['width'] = $thumbnail['width'];
                 $this->_content['height'] = $thumbnail['height'];
             } else {
                 $attributes['src'] = org_glizy_helpers_Media::getImageUrlById($this->_content['mediaId'], $this->getAttribute('width'), $this->getAttribute('height'), $this->getAttribute('crop'));
                 $this->_content['src'] = $attributes['src'];
             }
         }
         $useZoom = $attributes['zoom'];
         unset($attributes['description']);
         unset($attributes['mediaId']);
         unset($attributes['zoom']);
         unset($attributes['size']);
         unset($attributes['mediaType']);
         unset($attributes['originalSrc']);
         unset($attributes['__media__']);
         $this->_content['__html__'] = '<img ' . $this->_renderAttributes($attributes) . '/>';
         if ($this->getAttribute('zoom')) {
             if ($useZoom && $this->getAttribute('superZoom')) {
                 $this->_application->addZoomJsCode();
                 $this->_content['__html__'] .= '<span class="superzoom js-glizySuperZoom" data-mediaid="' . $this->media->id . '" data-mediawatermark="' . ($this->media->watermark ? '1' : '0') . '">' . $this->getAttribute('superZoomLabel') . '</span>';
             }
             $this->_application->addLightboxJsCode();
             $attributes = array();
             $attributes['title'] = $this->_content['title'];
             if ($this->media->type == 'IMAGE') {
                 $attributes['class'] = 'js-lightbox-image';
                 $attributes['href'] = org_glizycms_helpers_Media::getImageUrlById($this->media->id, __Config::get('IMG_WIDTH_ZOOM'), __Config::get('IMG_HEIGHT_ZOOM'));
             } else {
                 $attributes['class'] = 'js-lightbox-inline';
                 $attributes['href'] = org_glizycms_helpers_Media::getFileUrlById($this->media->id);
             }
             $attributes['data-type'] = strtolower($this->media->type);
             $attributes['rel'] = $this->getAttribute('group');
             $this->_content['__html__'] = org_glizy_helpers_Html::renderTag('a', $attributes, true, $this->_content['__html__']);
         }
     } else {
         $this->_content['__html__'] = '';
     }
 }