/** * @param IFile $image * @param IImageFormat $imageFormat * @return string path to file in storage */ public function getPath(IFile $image, IImageFormat $imageFormat = NULL) { if (!$imageFormat) { return parent::getPath($image); } $search = ['/', '<format>', '<month>', '<image>']; $replace = [DIRECTORY_SEPARATOR, $imageFormat->getName(), $image->getUploaded()->format('Ym'), $image->getName() . '.' . $image->getExt()]; return str_replace($search, $replace, $this->cacheStoragePath); }
/** * @param IImageFormat $imageFormat */ public function add(IImageFormat $imageFormat) { $this->imageFormats[$imageFormat->getName()] = $imageFormat; }