/** * @param ProductImage $image * @return ImageEvent */ public function createProductImageEvent(ProductImage $image) { $imageEvent = new ImageEvent($this->request); $baseSourceFilePath = ConfigQuery::read('images_library_path'); if ($baseSourceFilePath === null) { $baseSourceFilePath = THELIA_LOCAL_DIR . 'media' . DS . 'images'; } else { $baseSourceFilePath = THELIA_ROOT . $baseSourceFilePath; } // Put source image file path $sourceFilePath = sprintf('%s/%s/%s', $baseSourceFilePath, 'product', $image->getFile()); $imageEvent->setSourceFilepath($sourceFilePath); $imageEvent->setCacheSubdirectory('product'); return $imageEvent; }