/** * * init slide by db record */ 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 = UniteFunctionsRev::convertStdClassToArray($layers); $imageID = UniteFunctionsRev::getVal($params, "image_id"); //get image url and thumb url if (!empty($imageID)) { $this->imageID = $imageID; $imageUrl = UniteFunctionsWPRev::getUrlAttachmentImage($imageID); if (empty($imageUrl)) { $imageUrl = UniteFunctionsRev::getVal($params, "image"); } $this->imageThumb = UniteFunctionsWPRev::getUrlAttachmentImage($imageID, UniteFunctionsWPRev::THUMB_MEDIUM); } else { $imageUrl = UniteFunctionsRev::getVal($params, "image"); } //set image path, file and url $this->imageUrl = $imageUrl; $this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl); $realPath = UniteFunctionsWPRev::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; }
public function initByData($record) { if (isset($record["id"])) { $this->id = $record["id"]; } if (isset($record["slider_id"])) { $this->sliderID = $record["slider_id"]; } if (isset($record["slide_order"])) { $this->slideOrder = $record["slide_order"]; } $params = $record["params"]; if (get_magic_quotes_gpc()) { //changes made 1st Apr 2014 $params = stripslashes($params); } $params = (array) json_decode($params); $layers = $record["layers"]; if (get_magic_quotes_gpc()) { //changes made 1st Apr 2014 $layers = stripslashes($layers); } $layers = (array) json_decode($layers); $layers = UniteFunctionsRev::convertStdClassToArray($layers); $imageID = UniteFunctionsRev::getVal($params, "image_id"); //get image url and thumb url if (!empty($imageID)) { $this->imageID = $imageID; $imageUrl = UniteFunctionsWPRev::getUrlAttachmentImage($imageID); if (empty($imageUrl)) { $imageUrl = UniteFunctionsRev::getVal($params, "image"); } $this->imageThumb = UniteFunctionsWPRev::getUrlAttachmentImage($imageID, UniteFunctionsWPRev::THUMB_MEDIUM); } else { $imageUrl = UniteFunctionsRev::getVal($params, "image"); } if (is_ssl()) { $imageUrl = str_replace("http://", "https://", $imageUrl); } //dmp($imageUrl);exit(); //set image path, file and url $this->imageUrl = $imageUrl; $this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl); $realPath = UniteFunctionsWPRev::getPathContent() . $this->imageFilepath; if (file_exists($realPath) == false || is_file($realPath) == false) { $this->imageFilepath = ""; } $this->imageFilename = basename($this->imageUrl); $this->params = $params; $ijk = 0; foreach ($layers as $layer) { if (isset($layer['image_url']) && !empty($layer['image_url'])) { $layers[$ijk]['image_url'] = modify_image_url($layers[$ijk]['image_url']); } $ijk++; } $this->arrLayers = $layers; }
/** * * init slide by db record */ 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 = UniteFunctionsRev::convertStdClassToArray($layers); //set image path, file and url $this->imageUrl = UniteFunctionsRev::getVal($params, "image"); $this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl); $realPath = UniteFunctionsWPRev::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; }
/** * * set slide image by image id */ private function setImageByImageID($imageID) { $this->imageID = $imageID; $this->imageUrl = UniteFunctionsWPRev::getUrlAttachmentImage($imageID); $this->imageThumb = UniteFunctionsWPRev::getUrlAttachmentImage($imageID, UniteFunctionsWPRev::THUMB_MEDIUM); if (empty($this->imageUrl)) { return false; } $this->params["background_type"] = "image"; if (is_ssl()) { $this->imageUrl = str_replace("http://", "https://", $this->imageUrl); } $this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl); $realPath = UniteFunctionsWPRev::getPathContent() . $this->imageFilepath; if (file_exists($realPath) == false || is_file($realPath) == false) { $this->imageFilepath = ""; } $this->imageFilename = basename($this->imageUrl); }
/** * * on show image ajax event. outputs image with parameters */ public static function onShowImage() { $pathImages = UniteFunctionsWPRev::getPathContent(); $urlImages = UniteFunctionsWPRev::getUrlContent(); try { $imageView = new UniteImageViewRev(self::$path_cache, $pathImages, $urlImages); $imageView->showImageFromGet(); } catch (Exception $e) { header("status: 500"); echo $e->getMessage(); exit; } }
/** * get image real path phisical on disk from url */ public static function getImageRealPathFromUrl($urlImage) { $filepath = self::getImagePathFromURL($urlImage); $realPath = UniteFunctionsWPRev::getPathContent() . $filepath; return $realPath; }
/** * * on show image ajax event. outputs image with parameters */ public static function onShowImage() { $img = Tools::getValue('img'); if (empty($img)) { die('Image doesn\'t exists!'); } $pathImages = UniteFunctionsWPRev::getPathContent(); $urlImages = UniteFunctionsWPRev::getUrlContent(); try { $imageView = new UniteImageViewRev(self::$path_cache, $pathImages, $urlImages); $imageView->showImageFromGet(); } catch (Exception $e) { header("status: 500"); echo $e->getMessage(); exit; } }