public static function getInstanceByPath($path, $cacheDir = '')
    {
        $instance = new self();

        $instance->pathFile = $path;

        if (!empty($cacheDir)) {
            $instance->setCacheDir($cacheDir);
            $instance->setCachePath();
        }

        $instance->readImage();

        return $instance;
    }
public static function getInstanceByPath($path, $cacheDir = '')
    {
        $instance = new self();

        $instance->pathFile = $path;

        if (!empty($cacheDir)) {
            $instance->setCacheDir($cacheDir);
            $instance->setCachePath();
        }

        $instance->readImage();

        return $instance;
    }
public static function getInstanceByPath ( $ path , $ cacheDir = '' ) { $ instance = new self ( ) ; $ instance -> pathFile = $ path ; if ( ! empty ( $ cacheDir ) ) { $ instance -> setCacheDir ( $ cacheDir ) ; $ instance -> setCachePath ( ) ; } $ instance -> readImage ( ) ; return $ instance ; }
Creates a new image from file or URL.

@param string $path     Path to the image.
@param string $cacheDir Optional: Directory path for caching image files.

@return $this
Creates a new image from file or URL .