Example #1
0
 /**
  * Create all our thumbnail sizes are part of our upload process
  * @param $objImage
  */
 protected function createThumbnails($objImage)
 {
     foreach (ImagesType::$NameArray as $intType => $value) {
         if ($intType > 0) {
             list($intWidth, $intHeight) = ImagesType::GetSize($intType);
             $this->createThumb($objImage, $intWidth, $intHeight, $intType);
         }
     }
 }
Example #2
0
 public static function LoadByRowidSize($id, $intSize)
 {
     if ($intSize == ImagesType::normal) {
         return Images::model()->findByPk($id);
     }
     list($intWidth, $intHeight) = ImagesType::GetSize($intSize);
     return Images::LoadByWidthHeightParent($intWidth, $intHeight, $id);
 }
Example #3
0
 public function getProductPhotos($absolute = false)
 {
     $objImages = Images::model()->findAll(array('condition' => 'product_id=:id AND `parent`=`id` order by `index`', 'params' => array(':id' => $this->id)));
     // If this is a child product and it has no images, check to see if the master has images and use those
     if (count($objImages) == 0) {
         $objImages = Images::model()->findAll(array('condition' => 'product_id=:id AND `parent`=`id` order by `index`', 'params' => array(':id' => $this->parent)));
     }
     $arrImages = array();
     foreach ($objImages as $obj) {
         $a = array();
         $a['image'] = Images::GetLink($obj->id, ImagesType::pdetail, $absolute);
         $a['image_thumb'] = Images::GetLink($obj->id, ImagesType::preview, $absolute);
         $a['image_alt'] = $this->Title;
         $a['image_desc'] = '';
         $a['image_large'] = Images::GetLink($obj->id, ImagesType::normal, $absolute);
         if (CPropertyValue::ensureInteger(Yii::app()->params['LIGHTSPEED_CLOUD']) === 0) {
             list($wt, $ht) = ImagesType::GetSize(ImagesType::pdetail);
             if ($obj->width <= $wt && $obj->height <= $ht) {
                 $a['image_large'] = $a['image'];
             }
         }
         $arrImages[] = $a;
     }
     //This will force the no-product image
     if (count($objImages) == 0) {
         $a = array();
         $a['image'] = Images::GetImageFallbackPath($absolute);
         $a['image_large'] = Images::GetImageFallbackPath();
         $a['image_thumb'] = Images::GetImageFallbackPath();
         $a['image_alt'] = $this->Title;
         $a['image_desc'] = '';
         $arrImages[] = $a;
     }
     return $arrImages;
 }