public function __construct($image)
{
$this->isRemote = false;
if (is_string($image)) {
if (strpos($image, craft()->imager->getSetting('imagerUrl')) !== false) {
// url to a file that is in the imager library
$this->getPathsForLocalImagerFile($image);
} else {
if (strpos($image, 'http') === 0 || strpos($image, 'https') === 0 || strpos($image, '//') === 0) {
// external file
$this->isRemote = true;
if (strrpos($image, '//') === 0) {
$image = 'https:' . $image;
}
$this->_getPathsForUrl($image);
} else {
// relative path, assume that it's relative to document root
$this->_getPathsForLocaleFile($image);
}
}
} else {
// It's some kind of model
if (get_class($image) == 'Craft\\Imager_ImageModel') {
$this->getPathsForLocalImagerFile($image->url);
} else {
if ($image instanceof \Craft\AssetFileModel) {
if (!$image->getSource()->getSourceType()->isSourceLocal()) {
// it's a cloud source, pretend this is an external file for performance
$this->isRemote = true;
$this->_getPathsForUrl($image->getUrl());
} else {
// it's a local source
$this->_getPathsForLocalAsset($image);
}
} else {
throw new Exception(Craft::t('An unknown image object was used.'));
}
}
}
}