code/Controller/AssetAdmin.php
public function generateThumbnails(File $file, $thumbnailLinks = false)
    {
        $links = [];
        if (!$file->getIsImage()) {
            return $links;
        }
        $generator = $this->getThumbnailGenerator();

        // Small thumbnail
        $smallWidth = UploadField::config()->uninherited('thumbnail_width');
        $smallHeight = UploadField::config()->uninherited('thumbnail_height');

        // Large thumbnail
        $width = $this->config()->get('thumbnail_width');
        $height = $this->config()->get('thumbnail_height');

        // Generate links if client requests them
        // Note: Thumbnails should always be generated even if links are not
        if ($thumbnailLinks) {
            $links['smallThumbnail'] = $generator->generateThumbnailLink($file, $smallWidth, $smallHeight);
            $links['thumbnail'] = $generator->generateThumbnailLink($file, $width, $height);
        } else {
            $generator->generateThumbnail($file, $smallWidth, $smallHeight);
            $generator->generateThumbnail($file, $width, $height);
        }

        $this->extend('updateGeneratedThumbnails', $file, $links, $generator);
        return $links;
    }
public function generateThumbnails(File $file, $thumbnailLinks = false)
    {
        $links = [];
        if (!$file->getIsImage()) {
            return $links;
        }
        $generator = $this->getThumbnailGenerator();

        // Small thumbnail
        $smallWidth = UploadField::config()->uninherited('thumbnail_width');
        $smallHeight = UploadField::config()->uninherited('thumbnail_height');

        // Large thumbnail
        $width = $this->config()->get('thumbnail_width');
        $height = $this->config()->get('thumbnail_height');

        // Generate links if client requests them
        // Note: Thumbnails should always be generated even if links are not
        if ($thumbnailLinks) {
            $links['smallThumbnail'] = $generator->generateThumbnailLink($file, $smallWidth, $smallHeight);
            $links['thumbnail'] = $generator->generateThumbnailLink($file, $width, $height);
        } else {
            $generator->generateThumbnail($file, $smallWidth, $smallHeight);
            $generator->generateThumbnail($file, $width, $height);
        }

        $this->extend('updateGeneratedThumbnails', $file, $links, $generator);
        return $links;
    }
public function generateThumbnails ( File $ file , $ thumbnailLinks = false ) { $ links = [ ] ; if ( ! $ file -> getIsImage ( ) ) { return $ links ; } $ generator = $ this -> getThumbnailGenerator ( ) ; // Small thumbnail $ smallWidth = UploadField :: config ( ) -> uninherited ( 'thumbnail_width' ) ; $ smallHeight = UploadField :: config ( ) -> uninherited ( 'thumbnail_height' ) ; // Large thumbnail $ width = $ this -> config ( ) -> get ( 'thumbnail_width' ) ; $ height = $ this -> config ( ) -> get ( 'thumbnail_height' ) ; // Generate links if client requests them // Note: Thumbnails should always be generated even if links are not if ( $ thumbnailLinks ) { $ links [ 'smallThumbnail' ] = $ generator -> generateThumbnailLink ( $ file , $ smallWidth , $ smallHeight ) ; $ links [ 'thumbnail' ] = $ generator -> generateThumbnailLink ( $ file , $ width , $ height ) ; } else { $ generator -> generateThumbnail ( $ file , $ smallWidth , $ smallHeight ) ; $ generator -> generateThumbnail ( $ file , $ width , $ height ) ; } $ this -> extend ( 'updateGeneratedThumbnails' , $ file , $ links , $ generator ) ; return $ links ; }
Generate thumbnails and provide links for a given file

@param File $file
@param bool $thumbnailLinks
@return array
Generate thumbnails and provide links for a given file