コード例 #1
0
 /**
  * 
  * init the slider by id
  */
 public function initByID($slideid)
 {
     UniteFunctionsRev::validateNumeric($slideid, "Slide ID");
     $slideid = $this->db->escape($slideid);
     $record = $this->db->fetchSingle(GlobalsRevSlider::$table_slides, "id={$slideid}");
     $this->initByData($record);
 }
コード例 #2
0
 /**
  * 
  * init the slider object by database id
  */
 public function initByID($sliderID)
 {
     UniteFunctionsRev::validateNumeric($sliderID, "Slider ID");
     $sliderID = $this->db->escape($sliderID);
     $sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders, "id={$sliderID}");
     $this->initByDBData($sliderData);
 }
コード例 #3
0
 /**
  * 
  * init the slider object by database id
  */
 public function initByID($sliderID)
 {
     UniteFunctionsRev::validateNumeric($sliderID, "Slider ID");
     $sliderID = $this->db->escape($sliderID);
     try {
         $sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders, "id={$sliderID}");
     } catch (Exception $e) {
         UniteFunctionsRev::throwError("Slider with ID: {$sliderID} Not Found");
     }
     $this->initByDBData($sliderData);
 }
コード例 #4
0
 public function GetSliderImgSettings($sliderID)
 {
     UniteFunctionsRev::validateNumeric($sliderID, "Slider ID");
     $sliderID = $this->db->escape($sliderID);
     try {
         $sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders, "id={$sliderID}");
     } catch (Exception $e) {
         UniteFunctionsRev::throwError("Slider with ID: {$sliderID} Not Found");
     }
     return json_decode($sliderData['params'])->prd_img_size;
 }
コード例 #5
0
 private function handleImageEffects(&$imgHandle)
 {
     if (empty($this->effect)) {
         return false;
     }
     switch ($this->effect) {
         case self::EFFECT_BW:
             if (defined("IMG_FILTER_GRAYSCALE")) {
                 imagefilter($imgHandle, IMG_FILTER_GRAYSCALE);
             }
             break;
         case self::EFFECT_BRIGHTNESS:
             if (defined("IMG_FILTER_BRIGHTNESS")) {
                 if (!is_numeric($this->effect_arg1)) {
                     $this->effect_arg1 = 50;
                 }
                 //set default value
                 UniteFunctionsRev::validateNumeric($this->effect_arg1, "'ea1' argument");
                 imagefilter($imgHandle, IMG_FILTER_BRIGHTNESS, $this->effect_arg1);
             }
             break;
         case self::EFFECT_CONTRAST:
             if (defined("IMG_FILTER_CONTRAST")) {
                 if (!is_numeric($this->effect_arg1)) {
                     $this->effect_arg1 = -5;
                 }
                 //set default value
                 imagefilter($imgHandle, IMG_FILTER_CONTRAST, $this->effect_arg1);
             }
             break;
         case self::EFFECT_EDGE:
             if (defined("IMG_FILTER_EDGEDETECT")) {
                 imagefilter($imgHandle, IMG_FILTER_EDGEDETECT);
             }
             break;
         case self::EFFECT_EMBOSS:
             if (defined("IMG_FILTER_EMBOSS")) {
                 imagefilter($imgHandle, IMG_FILTER_EMBOSS);
             }
             break;
         case self::EFFECT_BLUR:
             if (defined("IMG_FILTER_GAUSSIAN_BLUR")) {
                 imagefilter($imgHandle, IMG_FILTER_GAUSSIAN_BLUR);
             }
             break;
         case self::EFFECT_MEAN:
             if (defined("IMG_FILTER_MEAN_REMOVAL")) {
                 imagefilter($imgHandle, IMG_FILTER_MEAN_REMOVAL);
             }
             break;
         case self::EFFECT_SMOOTH:
             if (defined("IMG_FILTER_SMOOTH")) {
                 if (!is_numeric($this->effect_arg1)) {
                     $this->effect_arg1 = 15;
                 }
                 //set default value
                 imagefilter($imgHandle, IMG_FILTER_SMOOTH, $this->effect_arg1);
             }
             break;
         default:
             $this->throwError("Effect not supported: <b>{$this->effect}</b>");
             break;
     }
 }
コード例 #6
0
 /**
  * 
  * getStaticSlide
  */
 public function getStaticSlideID($sliderID)
 {
     UniteFunctionsRev::validateNumeric($sliderID, "Slider ID");
     $sliderID = $this->db->escape($sliderID);
     $record = $this->db->fetch(GlobalsRevSlider::$table_static_slides, "slider_id={$sliderID}");
     if (empty($record)) {
         return false;
     } else {
         return $record[0]['id'];
     }
 }
コード例 #7
0
 public function GetSliderImgSettings($sliderID)
 {
     $img_arr = array();
     UniteFunctionsRev::validateNumeric($sliderID, "Slider ID");
     $sliderID = $this->db->escape($sliderID);
     try {
         $sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders, "id={$sliderID}");
     } catch (Exception $e) {
         UniteFunctionsRev::throwError("Slider with ID: {$sliderID} Not Found");
     }
     $sliderData = json_decode($sliderData['params']);
     $img_arr['width'] = isset($sliderData->prd_img_width) ? $sliderData->prd_img_width : '880';
     $img_arr['height'] = isset($sliderData->prd_img_height) ? $sliderData->prd_img_height : '350';
     return $img_arr;
 }