function getImage() { $image = $this->getVar("sp_image"); if (!empty($image["file"])) { mod_loadFunctions("url", $GLOBALS["artdirname"]); $image["url"] = art_getImageUrl($image["file"]); } else { $image = array(); } return $image; }
/** * get verified image url of the category * * @return string */ function getImage() { mod_loadFunctions("url", $GLOBALS["artdirname"]); $image = art_getImageUrl($this->getVar("cat_image")); return $image; }
/** * Function to get linked image located in module file folder * * @var string $imageName image file name * @var string $imagePath full path to the image file if different from preset folder * @var string $size size parameters for pseudo thumbnail * @var string $alt alter string * * @return string linked image tag */ function art_getImageLink($imageName, $imagePath = null, $size = null, $alt = "") { global $xoopsModuleConfig, $xoopsModule; if (empty($imageName)) { return null; } if (empty($size["width"]) && empty($size["height"])) { return "<img src=\"" . art_getImageUrl($imageName, $imagePath) . "\" alt=\"" . $alt . "\" />"; } if (empty($imagePath)) { $moduleConfig = art_load_config(); $path_image = $moduleConfig["path_image"]; $imageFile = XOOPS_ROOT_PATH . "/" . $path_image . "/" . htmlspecialchars($imageName); $imageUrl = XOOPS_URL . "/" . $path_image . "/" . htmlspecialchars($imageName); } else { if (!preg_match("/^" . preg_quote(XOOPS_ROOT_PATH, "/") . "/", $imagePath)) { $imagePath = XOOPS_ROOT_PATH . "/" . $imagePath; } $imageFile = htmlspecialchars($imagePATH . "/" . $imageName); $imageUrl = htmlspecialchars(XOOPS_URL . "/" . preg_replace("/^" . preg_quote(XOOPS_ROOT_PATH, "/") . "/", "", $imagePath) . "/" . $imageName); } $imageSizeString = ""; if (!($imageSize = @getimagesize($imageFile))) { } elseif (!empty($size["width"]) && $size["width"] < $imageSize[0]) { $imageSizeString = "width: " . $size["width"] . "px"; } elseif (!empty($size["height"]) && $size["height"] < $imageSize[1]) { $imageSizeString = "height: " . $size["height"] . "px"; } $link = "<img src=\"" . $imageUrl . "\" style=\"" . $imageSizeString . "\" alt=\"" . $alt . "\" />"; return $link; }
/** * get verified image of the article: url, caption * * @param bool $complete flag for retrieving image url * @return mixed array or null */ function getImage($complete = true) { $image = $this->getVar("art_image"); if (!empty($image["file"])) { if (!empty($complete)) { mod_loadFunctions("url", $GLOBALS["artdirname"]); $image["url"] = art_getImageUrl($image["file"]); } } else { $image = null; } return $image; }