url = $url; $this->imageHelper = $imageHelper; } /** * Retrieve image url * @return string */ public function getUrl() { if ($this->getFile()) { return $this->url->getMediaUrl($this->getFile()); } return null; } /** * Resize image * @param int $width * @param int $height * @return string */ public function resize($width, $height = null) { return $this->imageHelper->init($this->getFile()) ->resize($width, $height); } /** * Retrieve image url * @return string */ public function __toString() { return $this->getUrl(); } }