src/BaseImage.php
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.');
    }
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.');
    }
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.' ) ; }
Takes either file path or ImageInterface. In case of file path, creates an instance of ImageInterface from it.

@param string|resource|ImageInterface $image
@return ImageInterface
@throws \yii\base\InvalidParamException
@since 2.1.0
Takes either file path or ImageInterface . In case of file path creates an instance of ImageInterface from it .