public function popup($fileName = null, $width = null, $height = null, $crop = null, $title = null)
    {
        if (empty($fileName)) {
            return '';
        }

        $thumbconf = $this->config->get('general/thumbnails');
        $fullwidth = !empty($thumbconf['default_image'][0]) ? $thumbconf['default_image'][0] : 1000;
        $fullheight = !empty($thumbconf['default_image'][1]) ? $thumbconf['default_image'][1] : 750;

        $thumb = $this->getThumbnail($fileName, $width, $height, $crop);
        $largeThumb = $this->getThumbnail($fileName, $fullwidth, $fullheight, 'r');

        // BC Nightmare… If we're passed a title, use it, if not we might have
        // one in the $fileName array, else use the file name
        $title = $title ?: $thumb->getTitle() ?: sprintf('%s: %s', Trans::__('general.phrase.image'), $thumb->getFileName());
        $altTitle = $thumb->getAltTitle() ?: $title;

        if ($this->getThumbnailUri($largeThumb)) {
            $output = sprintf(
                '<a href="%s" class="magnific" title="%s"><img src="%s" width="%s" height="%s" alt="%s"></a>',
                $this->getThumbnailUri($largeThumb),
                $title,
                $this->getThumbnailUri($thumb),
                $thumb->getWidth(),
                $thumb->getHeight(),
                $altTitle
            );
        } else {
            $output = '';
        }

        return $output;
    }
public function popup($fileName = null, $width = null, $height = null, $crop = null, $title = null)
    {
        if (empty($fileName)) {
            return '';
        }

        $thumbconf = $this->config->get('general/thumbnails');
        $fullwidth = !empty($thumbconf['default_image'][0]) ? $thumbconf['default_image'][0] : 1000;
        $fullheight = !empty($thumbconf['default_image'][1]) ? $thumbconf['default_image'][1] : 750;

        $thumb = $this->getThumbnail($fileName, $width, $height, $crop);
        $largeThumb = $this->getThumbnail($fileName, $fullwidth, $fullheight, 'r');

        // BC Nightmare… If we're passed a title, use it, if not we might have
        // one in the $fileName array, else use the file name
        $title = $title ?: $thumb->getTitle() ?: sprintf('%s: %s', Trans::__('general.phrase.image'), $thumb->getFileName());
        $altTitle = $thumb->getAltTitle() ?: $title;

        if ($this->getThumbnailUri($largeThumb)) {
            $output = sprintf(
                '<a href="%s" class="magnific" title="%s"><img src="%s" width="%s" height="%s" alt="%s"></a>',
                $this->getThumbnailUri($largeThumb),
                $title,
                $this->getThumbnailUri($thumb),
                $thumb->getWidth(),
                $thumb->getHeight(),
                $altTitle
            );
        } else {
            $output = '';
        }

        return $output;
    }
public function popup ( $ fileName = null , $ width = null , $ height = null , $ crop = null , $ title = null ) { if ( empty ( $ fileName ) ) { return '' ; } $ thumbconf = $ this -> config -> get ( 'general/thumbnails' ) ; $ fullwidth = ! empty ( $ thumbconf [ 'default_image' ] [ 0 ] ) ? $ thumbconf [ 'default_image' ] [ 0 ] : 1000 ; $ fullheight = ! empty ( $ thumbconf [ 'default_image' ] [ 1 ] ) ? $ thumbconf [ 'default_image' ] [ 1 ] : 750 ; $ thumb = $ this -> getThumbnail ( $ fileName , $ width , $ height , $ crop ) ; $ largeThumb = $ this -> getThumbnail ( $ fileName , $ fullwidth , $ fullheight , 'r' ) ; // BC Nightmare… If we're passed a title, use it, if not we might have // one in the $fileName array, else use the file name $ title = $ title ? : $ thumb -> getTitle ( ) ? : sprintf ( '%s: %s' , Trans :: __ ( 'general.phrase.image' ) , $ thumb -> getFileName ( ) ) ; $ altTitle = $ thumb -> getAltTitle ( ) ? : $ title ; if ( $ this -> getThumbnailUri ( $ largeThumb ) ) { $ output = sprintf ( '<a href="%s" class="magnific" title="%s"><img src="%s" width="%s" height="%s" alt="%s"></a>' , $ this -> getThumbnailUri ( $ largeThumb ) , $ title , $ this -> getThumbnailUri ( $ thumb ) , $ thumb -> getWidth ( ) , $ thumb -> getHeight ( ) , $ altTitle ) ; } else { $ output = '' ; } return $ output ; }
Helper function to wrap an image in a Magnific popup HTML tag, with thumbnail.

example: {{ content.image|popup(320, 240) }}
example: {{ popup(content.image, 320, 240) }}
example: {{ content.image|popup(width=320, height=240, title="My Image") }}

Note: This function used to be called 'fancybox', but Fancybox was
deprecated in favour of the Magnific Popup library.

@param string|array $fileName Image file name
@param int          $width    Image width
@param int          $height   Image height
@param string       $crop     Crop image string identifier
@param string       $title    Display title for image

@return string HTML output
Helper function to wrap an image in a Magnific popup HTML tag with thumbnail .