/**
  * Returns object instance
  *
  * @return oxPictureHandler
  */
 public static function getInstance()
 {
     // disable caching for test modules
     if (defined('OXID_PHP_UNIT')) {
         self::$_instance = modInstances::getMod(__CLASS__);
     }
     if (!self::$_instance instanceof oxPictureHandler) {
         self::$_instance = oxNew('oxPictureHandler');
         if (defined('OXID_PHP_UNIT')) {
             modInstances::addMod(__CLASS__, self::$_instance);
         }
     }
     return self::$_instance;
 }
 /**
  * Finds and returns product picture file or folder url
  *
  * @param string $sFile   File name
  * @param bool   $blAdmin Whether to force admin
  * @param bool   $blSSL   Whether to force ssl
  * @param int    $iLang   Language
  * @param int    $iShopId Shop id
  * @param string $sDefPic Default (nopic) image path ["0/nopic.jpg"]
  *
  * @return string
  */
 public function getPictureUrl($sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg")
 {
     if ($sAltUrl = oxPictureHandler::getInstance()->getAltImageUrl('/', $sFile, $blSSL)) {
         return $sAltUrl;
     }
     $blNativeImg = $this->getConfigParam('blNativeImages');
     $sUrl = $this->getUrl($sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
     //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
     if (!$sUrl && $sDefPic) {
         $sUrl = $this->getUrl($sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
     }
     return $sUrl;
 }
 /**
  * Returns category promotion icon picture url if exist, false - if not
  *
  * @return mixed
  */
 public function getPromotionIconUrl()
 {
     if ($sIcon = $this->oxcategories__oxpromoicon->value) {
         $sSize = $this->getConfig()->getConfigParam('sCatPromotionsize');
         return oxPictureHandler::getInstance()->getPicUrl("category/promo_icon/", $sIcon, $sSize);
     }
 }
 /**
  * Returns article picture
  *
  * @return string
  */
 public function getIconUrl()
 {
     if ($sIcon = $this->oxvendor__oxicon->value) {
         $oConfig = $this->getConfig();
         $sSize = $oConfig->getConfigParam('sManufacturerIconsize');
         if (!isset($sSize)) {
             $sSize = $oConfig->getConfigParam('sIconsize');
         }
         return oxPictureHandler::getInstance()->getPicUrl("vendor/icon/", $sIcon, $sSize);
     }
 }
 /**
  * Deletes thumbnail file
  *
  * @param oxArticle $oArticle article object
  *
  * @return null
  */
 protected function _deleteThumbnail($oArticle)
 {
     if ($oArticle->oxarticles__oxthumb->value) {
         if (!$oArticle->isDerived()) {
             $oPicHandler = oxPictureHandler::getInstance();
             $oPicHandler->deleteThumbnail($oArticle);
         }
         //reseting field
         $oArticle->oxarticles__oxthumb = new oxField();
     }
 }
 /**
  * Delete pics
  *
  * @return null
  */
 protected function _deletePics()
 {
     $myUtilsPic = oxUtilsPic::getInstance();
     $myConfig = $this->getConfig();
     $oPictureHandler = oxPictureHandler::getInstance();
     //deleting custom main icon
     $oPictureHandler->deleteMainIcon($this);
     //deleting custom thumbnail
     $oPictureHandler->deleteThumbnail($this);
     $sAbsDynImageDir = $myConfig->getPictureDir(false);
     // deleting master image and all generated images
     $iPicCount = $myConfig->getConfigParam('iPicCount');
     for ($i = 1; $i <= $iPicCount; $i++) {
         $oPictureHandler->deleteArticleMasterPicture($this, $i);
     }
 }