public function resize(
        $imageData,
        $height,
        $width,
        $type = ElcodiMediaImageResizeTypes::FORCE_MEASURES
    ) {
        $originalResource = imagecreatefromstring($imageData);
        $originalWidth = imagesx($originalResource);
        $originalHeight = imagesy($originalResource);
        $dimensions = Dimensions::create(
            $originalWidth,
            $originalHeight,
            $width,
            $height,
            $type
        );

        $newResource = imagecreatetruecolor(
            $dimensions->getDstFrameX(),
            $dimensions->getDstFrameY()
        );

        $backgroundColor = imagecolorallocate($newResource, 255, 255, 255);
        imagefill($newResource, 0, 0, $backgroundColor);

        imagecopyresampled(
            $newResource,
            $originalResource,
            $dimensions->getDstX(),
            $dimensions->getDstY(),
            $dimensions->getSrcX(),
            $dimensions->getSrcY(),
            $dimensions->getDstWidth(),
            $dimensions->getDstHeight(),
            $dimensions->getSrcWidth(),
            $dimensions->getSrcHeight()
        );

        ob_start();
        imagejpeg($newResource);
        $content = ob_get_contents();
        ob_end_clean();

        return $content;
    }
public function resize(
        $imageData,
        $height,
        $width,
        $type = ElcodiMediaImageResizeTypes::FORCE_MEASURES
    ) {
        $originalResource = imagecreatefromstring($imageData);
        $originalWidth = imagesx($originalResource);
        $originalHeight = imagesy($originalResource);
        $dimensions = Dimensions::create(
            $originalWidth,
            $originalHeight,
            $width,
            $height,
            $type
        );

        $newResource = imagecreatetruecolor(
            $dimensions->getDstFrameX(),
            $dimensions->getDstFrameY()
        );

        $backgroundColor = imagecolorallocate($newResource, 255, 255, 255);
        imagefill($newResource, 0, 0, $backgroundColor);

        imagecopyresampled(
            $newResource,
            $originalResource,
            $dimensions->getDstX(),
            $dimensions->getDstY(),
            $dimensions->getSrcX(),
            $dimensions->getSrcY(),
            $dimensions->getDstWidth(),
            $dimensions->getDstHeight(),
            $dimensions->getSrcWidth(),
            $dimensions->getSrcHeight()
        );

        ob_start();
        imagejpeg($newResource);
        $content = ob_get_contents();
        ob_end_clean();

        return $content;
    }
public function resize ( $ imageData , $ height , $ width , $ type = ElcodiMediaImageResizeTypes :: FORCE_MEASURES ) { $ originalResource = imagecreatefromstring ( $ imageData ) ; $ originalWidth = imagesx ( $ originalResource ) ; $ originalHeight = imagesy ( $ originalResource ) ; $ dimensions = Dimensions :: create ( $ originalWidth , $ originalHeight , $ width , $ height , $ type ) ; $ newResource = imagecreatetruecolor ( $ dimensions -> getDstFrameX ( ) , $ dimensions -> getDstFrameY ( ) ) ; $ backgroundColor = imagecolorallocate ( $ newResource , 255 , 255 , 255 ) ; imagefill ( $ newResource , 0 , 0 , $ backgroundColor ) ; imagecopyresampled ( $ newResource , $ originalResource , $ dimensions -> getDstX ( ) , $ dimensions -> getDstY ( ) , $ dimensions -> getSrcX ( ) , $ dimensions -> getSrcY ( ) , $ dimensions -> getDstWidth ( ) , $ dimensions -> getDstHeight ( ) , $ dimensions -> getSrcWidth ( ) , $ dimensions -> getSrcHeight ( ) ) ; ob_start ( ) ; imagejpeg ( $ newResource ) ; $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ content ; }
Interface for resize implementations.

@param string $imageData Image Data
@param int    $height    Height value
@param int    $width     Width value
@param int    $type      Type

@return string Resized image data
Interface for resize implementations .