private function getPathUrl($name, $resolution, $method) { if ($this->absoluteUrl) { return $this->path->getAbsoluteUrl($name, $resolution, $method); } return $this->path->getUrl($name, $resolution, $method); }
/** * @param Utils\Image $image * @param string $path * @param string $extension * @return Image */ public function saveImage(Utils\Image $image, $path, $extension) { do { $relativePath = self::addSlashPath($path) . md5(microtime()) . '.' . strtolower($extension); $filename = $this->path->getSourceDir($relativePath); } while (is_file($filename)); if ($this->maxSize) { $image->resize($this->maxSize['width'], $this->maxSize['height'], Utils\Image::SHRINK_ONLY); } Utils\FileSystem::createDir(dirname($filename)); $image->save($filename); return new Image($this->path->getSourceDir(''), $relativePath); }
/** * @param string $resolution * @param string $name * @param int $method * @return ImagePath */ public function createImagePath($resolution, $name, $method) { $url = $this->hostUrl . '/' . $this->path->getRawUrl($name, $resolution, $method); return $this->local->saveFile($url, $name, $resolution, $method); }