src/Model/Behavior/ProfferBehavior.php
protected function createThumbnails(EntityInterface $entity, array $settings, ProfferPathInterface $path)
    {
        if (getimagesize($path->fullPath()) !== false && isset($settings['thumbnailSizes'])) {
            $imagePaths = [$path->fullPath()];

            if (!empty($settings['transformClass'])) {
                $imageTransform = new $settings['transformClass']($this->_table, $path);
                if (!$imageTransform instanceof ImageTransformInterface) {
                    throw new InvalidClassException("Class {$settings['pathClass']} does not implement the ImageTransformInterface.");
                }
            } else {
                $imageTransform = new ImageTransform($this->_table, $path);
            }

            $thumbnailPaths = $imageTransform->processThumbnails($settings);
            $imagePaths = array_merge($imagePaths, $thumbnailPaths);

            $eventData = ['path' => $path, 'images' => $imagePaths];
            $event = new Event('Proffer.afterCreateImage', $entity, $eventData);
            $this->_table->getEventManager()->dispatch($event);
        }
    }
protected function createThumbnails(EntityInterface $entity, array $settings, ProfferPathInterface $path)
    {
        if (getimagesize($path->fullPath()) !== false && isset($settings['thumbnailSizes'])) {
            $imagePaths = [$path->fullPath()];

            if (!empty($settings['transformClass'])) {
                $imageTransform = new $settings['transformClass']($this->_table, $path);
                if (!$imageTransform instanceof ImageTransformInterface) {
                    throw new InvalidClassException("Class {$settings['pathClass']} does not implement the ImageTransformInterface.");
                }
            } else {
                $imageTransform = new ImageTransform($this->_table, $path);
            }

            $thumbnailPaths = $imageTransform->processThumbnails($settings);
            $imagePaths = array_merge($imagePaths, $thumbnailPaths);

            $eventData = ['path' => $path, 'images' => $imagePaths];
            $event = new Event('Proffer.afterCreateImage', $entity, $eventData);
            $this->_table->getEventManager()->dispatch($event);
        }
    }
protected function createThumbnails ( EntityInterface $ entity , array $ settings , ProfferPathInterface $ path ) { if ( getimagesize ( $ path -> fullPath ( ) ) !== false && isset ( $ settings [ 'thumbnailSizes' ] ) ) { $ imagePaths = [ $ path -> fullPath ( ) ] ; if ( ! empty ( $ settings [ 'transformClass' ] ) ) { $ imageTransform = new $ settings [ 'transformClass' ] ( $ this -> _table , $ path ) ; if ( ! $ imageTransform instanceof ImageTransformInterface ) { throw new InvalidClassException ( "Class {$settings['pathClass']} does not implement the ImageTransformInterface." ) ; } } else { $ imageTransform = new ImageTransform ( $ this -> _table , $ path ) ; } $ thumbnailPaths = $ imageTransform -> processThumbnails ( $ settings ) ; $ imagePaths = array_merge ( $ imagePaths , $ thumbnailPaths ) ; $ eventData = [ 'path' => $ path , 'images' => $ imagePaths ] ; $ event = new Event ( 'Proffer.afterCreateImage' , $ entity , $ eventData ) ; $ this -> _table -> getEventManager ( ) -> dispatch ( $ event ) ; } }
Create a new image transform instance, and create any configured thumbnails; if the upload is an image and there
are thumbnails configured.

@param \Cake\Datasource\EntityInterface $entity Instance of the entity
@param array $settings Array of upload field settings
@param \Proffer\Lib\ProfferPathInterface $path Instance of the path class

@throws \App\Exception\InvalidClassException If the transform class doesn't implement the interface

@return void
Create a new image transform instance and create any configured thumbnails ; if the upload is an image and there are thumbnails configured .