public function onGetSidebarThumbnail()
    {
        $path = Input::get('path');
        $lastModified = Input::get('lastModified');

        $thumbnailParams = $this->getThumbnailParams();
        $thumbnailParams['width'] = 300;
        $thumbnailParams['height'] = 255;
        $thumbnailParams['mode'] = 'auto';

        $path = MediaLibrary::validatePath($path);

        if (!is_numeric($lastModified)) {
            throw new ApplicationException('Invalid input data');
        }

        /*
         * If the thumbnail file exists, just return the thumbnail markup,
         * otherwise generate a new thumbnail.
         */
        $thumbnailPath = $this->thumbnailExists($thumbnailParams, $path, $lastModified);
        if ($thumbnailPath) {
            return [
                'markup' => $this->makePartial('thumbnail-image', [
                    'isError' => $this->thumbnailIsError($thumbnailPath),
                    'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
                ])
            ];
        }

        $thumbnailInfo = $thumbnailParams;
        $thumbnailInfo['path'] = $path;
        $thumbnailInfo['lastModified'] = $lastModified;
        $thumbnailInfo['id'] = 'sidebar-thumbnail';

        return $this->generateThumbnail($thumbnailInfo, $thumbnailParams, true);
    }
public function onGetSidebarThumbnail()
    {
        $path = Input::get('path');
        $lastModified = Input::get('lastModified');

        $thumbnailParams = $this->getThumbnailParams();
        $thumbnailParams['width'] = 300;
        $thumbnailParams['height'] = 255;
        $thumbnailParams['mode'] = 'auto';

        $path = MediaLibrary::validatePath($path);

        if (!is_numeric($lastModified)) {
            throw new ApplicationException('Invalid input data');
        }

        /*
         * If the thumbnail file exists, just return the thumbnail markup,
         * otherwise generate a new thumbnail.
         */
        $thumbnailPath = $this->thumbnailExists($thumbnailParams, $path, $lastModified);
        if ($thumbnailPath) {
            return [
                'markup' => $this->makePartial('thumbnail-image', [
                    'isError' => $this->thumbnailIsError($thumbnailPath),
                    'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
                ])
            ];
        }

        $thumbnailInfo = $thumbnailParams;
        $thumbnailInfo['path'] = $path;
        $thumbnailInfo['lastModified'] = $lastModified;
        $thumbnailInfo['id'] = 'sidebar-thumbnail';

        return $this->generateThumbnail($thumbnailInfo, $thumbnailParams, true);
    }
public function onGetSidebarThumbnail ( ) { $ path = Input :: get ( 'path' ) ; $ lastModified = Input :: get ( 'lastModified' ) ; $ thumbnailParams = $ this -> getThumbnailParams ( ) ; $ thumbnailParams [ 'width' ] = 300 ; $ thumbnailParams [ 'height' ] = 255 ; $ thumbnailParams [ 'mode' ] = 'auto' ; $ path = MediaLibrary :: validatePath ( $ path ) ; if ( ! is_numeric ( $ lastModified ) ) { throw new ApplicationException ( 'Invalid input data' ) ; } /*
         * If the thumbnail file exists, just return the thumbnail markup,
         * otherwise generate a new thumbnail.
         */ $ thumbnailPath = $ this -> thumbnailExists ( $ thumbnailParams , $ path , $ lastModified ) ; if ( $ thumbnailPath ) { return [ 'markup' => $ this -> makePartial ( 'thumbnail-image' , [ 'isError' => $ this -> thumbnailIsError ( $ thumbnailPath ) , 'imageUrl' => $ this -> getThumbnailImageUrl ( $ thumbnailPath ) ] ) ] ; } $ thumbnailInfo = $ thumbnailParams ; $ thumbnailInfo [ 'path' ] = $ path ; $ thumbnailInfo [ 'lastModified' ] = $ lastModified ; $ thumbnailInfo [ 'id' ] = 'sidebar-thumbnail' ; return $ this -> generateThumbnail ( $ thumbnailInfo , $ thumbnailParams , true ) ; }
Get thumbnail AJAX handler
@return array
Get thumbnail AJAX handler