public function resize(
        ImageInterface $image,
        $height,
        $width,
        $type = ElcodiMediaImageResizeTypes::FORCE_MEASURES
    ) {
        $imageData = $this
            ->fileManager
            ->downloadFile($image)
            ->getContent();

        if (ElcodiMediaImageResizeTypes::NO_RESIZE === $type) {
            $image->setContent($imageData);

            return $image;
        }

        $resizedImageData = $this
            ->resizeAdapter
            ->resize($imageData, $height, $width, $type);

        /**
         * We need to physically store the new resized
         * image in order to access its metadata, such as
         * file size, image dimensions, mime type etc.
         * Ideally, we should be doing this in memory.
         */
        $resizedFile = new File(tempnam(sys_get_temp_dir(), '_generated'));
        file_put_contents($resizedFile, $resizedImageData);

        $image = $this->createImage($resizedFile);
        $image->setContent($resizedImageData);

        unlink($resizedFile);

        return $image;
    }
public function resize(
        ImageInterface $image,
        $height,
        $width,
        $type = ElcodiMediaImageResizeTypes::FORCE_MEASURES
    ) {
        $imageData = $this
            ->fileManager
            ->downloadFile($image)
            ->getContent();

        if (ElcodiMediaImageResizeTypes::NO_RESIZE === $type) {
            $image->setContent($imageData);

            return $image;
        }

        $resizedImageData = $this
            ->resizeAdapter
            ->resize($imageData, $height, $width, $type);

        /**
         * We need to physically store the new resized
         * image in order to access its metadata, such as
         * file size, image dimensions, mime type etc.
         * Ideally, we should be doing this in memory.
         */
        $resizedFile = new File(tempnam(sys_get_temp_dir(), '_generated'));
        file_put_contents($resizedFile, $resizedImageData);

        $image = $this->createImage($resizedFile);
        $image->setContent($resizedImageData);

        unlink($resizedFile);

        return $image;
    }
public function resize ( ImageInterface $ image , $ height , $ width , $ type = ElcodiMediaImageResizeTypes :: FORCE_MEASURES ) { $ imageData = $ this -> fileManager -> downloadFile ( $ image ) -> getContent ( ) ; if ( ElcodiMediaImageResizeTypes :: NO_RESIZE === $ type ) { $ image -> setContent ( $ imageData ) ; return $ image ; } $ resizedImageData = $ this -> resizeAdapter -> resize ( $ imageData , $ height , $ width , $ type ) ; /**
         * We need to physically store the new resized
         * image in order to access its metadata, such as
         * file size, image dimensions, mime type etc.
         * Ideally, we should be doing this in memory.
         */ $ resizedFile = new File ( tempnam ( sys_get_temp_dir ( ) , '_generated' ) ) ; file_put_contents ( $ resizedFile , $ resizedImageData ) ; $ image = $ this -> createImage ( $ resizedFile ) ; $ image -> setContent ( $ resizedImageData ) ; unlink ( $ resizedFile ) ; return $ image ; }
Given an image, resize it.

@param ImageInterface $image  Image
@param int            $height Height
@param int            $width  Width
@param int            $type   Type

@return ImageInterface New Image instance
Given an image resize it .