Exemple #1
0
 /**
  * Old legacy way to generate a thumbnail.
  *
  * Use it upon a new Image management system is available.
  *
  * @param $imageId
  * @param string $imageType
  * @param string $tableName
  * @param string $imageDir
  * @return string The HTML < img > tag
  */
 public function getThumbnailForListing($imageId, $imageType = 'jpg', $tableName = 'product', $imageDir = 'p')
 {
     if ($tableName == 'product') {
         $image = new \Image($imageId);
         $path_to_image = _PS_IMG_DIR_ . $imageDir . '/' . $image->getExistingImgPath() . '.' . $imageType;
     } else {
         $path_to_image = _PS_IMG_DIR_ . $imageDir . '/' . $imageId . '.' . $imageType;
     }
     $thumbPath = \ImageManager::thumbnail($path_to_image, $tableName . '_mini_' . $imageId . '.' . $imageType, 45, $imageType);
     // because legacy uses relative path to reach a directory under root directory...
     $replacement = 'src="' . $this->legacyContext->getRootUrl();
     $thumbPath = preg_replace('/src="(\\.\\.\\/)+/', $replacement, $thumbPath);
     return $thumbPath;
 }
 public function __construct($parameters)
 {
     parent::__construct($parameters);
     $this->pageIdentifierMap += array("setup wizard" => "/ezsetup");
     $this->packages += array('ez publish demo site' => 'ezdemo_site', 'ez publish demo site (without demo content)' => 'ezdemo_site_clean');
 }