Exemple #1
0
 /**
  * Returns the path to the folder containing the image in the new filesystem
  *
  * @return string path to folder
  */
 public function getImageFolder()
 {
     if (!$this->image_id) {
         return false;
     }
     if (!$this->folder) {
         $this->folder = JeproshopImageModelImage::getStaticImageFolder($this->image_id);
     }
     return $this->folder;
 }
Exemple #2
0
 /**
  * Returns a link to a product image for display
  * Note: the new image filesystem stores product images in subdirectories of img/p/
  *
  * @param string $name rewrite link of the image
  * @param string $ids id part of the image filename - can be "id_product-id_image" (legacy support, recommended) or "id_image" (new)
  * @param string $type
  * @return string
  */
 public function getImageLink($name, $ids, $type = null)
 {
     $not_default = false;
     if (is_array($name)) {
         $name = $name[JeproshopContext::getContext()->language->lang_id];
     }
     // legacy mode or default image
     $theme = JeproshopShopModelShop::isFeaturePublished() && file_exists(COM_JEPROSHOP_PRODUCT_IMAGE_DIRECTORY . $ids . ($type ? '_' . $type : '') . '_' . (int) JeproshopContext::getContext()->shop->theme_id . '.jpg') ? '_' . JeproshopContext::getContext()->shop->theme_id : '';
     if (JeproshopSettingModelSetting::getValue('legacy_images') && file_exists(COM_JEPROSHOP_PRODUCT_IMAGE_DIRECTORY . $ids . ($type ? '-' . $type : '') . $theme . '.jpg') || ($not_default = strpos($ids, 'default') !== false)) {
         if ($this->allow_link_rewrite == 1 && !$not_default) {
             echo $name;
             $uri_path = JURI::base() . $ids . ($type ? '_' . $type : '') . $theme . '/' . $name . '.jpg';
         } else {
             $uri_path = JURI::base() . 'components/com_jeproshop/assets/themes/' . $ids . ($type ? '_' . $type : '') . $theme . '.jpg';
         }
     } else {
         // if ids if of the form product_id-id_image, we want to extract the id_image part
         $split_ids = explode('_', $ids);
         $image_id = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
         $theme = JeproshopShopModelShop::isFeaturePublished() && file_exists(COM_JEPROSHOP_PRODUCT_IMAGE_DIRECTORY . JeproshopImageModelImage::getStaticImageFolder($image_id) . $image_id . ($type ? '_' . $type : '') . '_' . (int) JeproshopContext::getContext()->shop->theme_id . '.jpg') ? '_' . JeproshopContext::getContext()->shop->theme_id : '';
         if ($this->allow_link_rewrite == 1) {
             $uri_path = JURI::base() . $image_id . ($type ? '_' . $type : '') . $theme . '/' . $name . '.jpg';
         } else {
             $uri_path = JURI::base() . COM_JEPROSHOP_PRODUCT_IMAGE_DIRECTORY . JeproshopImageModelImage::getStaticImageFolder($image_id) . $image_id . ($type ? '_' . $type : '') . $theme . '.jpg';
         }
     }
     //return JeproshopTools::getMediaServer($uri_path).$uri_path;
     return $uri_path;
 }