public function initByData($record)
 {
     $this->id = $record["id"];
     $this->sliderID = $record["slider_id"];
     $this->slideOrder = $record["slide_order"];
     $params = $record["params"];
     $params = (array) json_decode($params);
     $layers = $record["layers"];
     $layers = (array) json_decode($layers);
     $layers = UniteFunctionsBanner::convertStdClassToArray($layers);
     $imageID = UniteFunctionsBanner::getVal($params, "image_id");
     //Get image url and thumb url
     if (!empty($imageID)) {
         $this->imageID = $imageID;
         $imageUrl = UniteFunctionsWPBanner::getUrlAttachmentImage($imageID);
         if (empty($imageUrl)) {
             $imageUrl = UniteFunctionsBanner::getVal($params, "image");
         }
         $this->imageThumb = UniteFunctionsWPBanner::getUrlAttachmentImage($imageID, UniteFunctionsWPBanner::THUMB_MEDIUM);
     } else {
         $imageUrl = UniteFunctionsBanner::getVal($params, "image");
     }
     //Set image path, file and url
     $this->imageUrl = $imageUrl;
     $this->imageFilepath = UniteFunctionsWPBanner::getImagePathFromURL($this->imageUrl);
     $realPath = UniteFunctionsWPBanner::getPathContent() . $this->imageFilepath;
     if (file_exists($realPath) == false || is_file($realPath) == false) {
         $this->imageFilepath = "";
     }
     $this->imageFilename = basename($this->imageUrl);
     $this->params = $params;
     $this->arrLayers = $layers;
 }
Exemplo n.º 2
0
 public static function onShowImage()
 {
     $pathImages = UniteFunctionsWPBanner::getPathContent();
     $urlImages = UniteFunctionsWPBanner::getUrlContent();
     try {
         $imageView = new UniteImageViewBanner(self::$path_cache, $pathImages, $urlImages);
         $imageView->showImageFromGet();
     } catch (Exception $e) {
         header("status: 500");
         echo $e->getMessage();
         exit;
     }
 }
 public static function getImageRealPathFromUrl($urlImage)
 {
     $filepath = self::getImagePathFromURL($urlImage);
     $realPath = UniteFunctionsWPBanner::getPathContent() . $filepath;
     return $realPath;
 }