yii\imagine\BaseImage::ensureImageInterfaceInstance PHP 메소드

ensureImageInterfaceInstance() 보호된 정적인 메소드

Takes either file path or ImageInterface. In case of file path, creates an instance of ImageInterface from it.
부터: 2.1.0
protected static ensureImageInterfaceInstance ( string | resource | Imagine\Image\ImageInterface $image ) : Imagine\Image\ImageInterface
$image string | resource | Imagine\Image\ImageInterface
리턴 Imagine\Image\ImageInterface
    protected static function ensureImageInterfaceInstance($image)
    {
        if ($image instanceof ImageInterface) {
            return $image;
        }
        if (is_resource($image)) {
            return static::getImagine()->read($image);
        }
        if (is_string($image)) {
            return static::getImagine()->open(Yii::getAlias($image));
        }
        throw new InvalidParamException('File should be either ImageInterface, resource or a string containing file path.');
    }