/** * get image path (for images located in a template directory) * * @access public * @param string full image filename (e.g. myimage.png) * @param boolean should be set to true, if the image is within a module * template directory (e.g. content/templates/default/images/test.png) * @static * */ public static function getImagePath($img, $module_path = "", $mode = "output", $offline = false) { global $ilias, $styleDefinition, $ilCtrl, $ilUser; if (is_int(strpos($_SERVER["PHP_SELF"], "setup.php"))) { $module_path = ".."; } if ($module_path != "") { $module_path = "/" . $module_path; } // default image $default_img = "." . $module_path . "/templates/default/images/" . $img; // use ilStyleDefinition instead of account to get the current skin and style require_once "./Services/Style/classes/class.ilStyleDefinition.php"; $current_skin = ilStyleDefinition::getCurrentSkin(); $current_style = ilStyleDefinition::getCurrentStyle(); if (is_object($styleDefinition)) { $image_dir = $styleDefinition->getImageDirectory(ilStyleDefinition::getCurrentMasterStyle(), $current_style); } if ($current_skin == "default") { $user_img = "." . $module_path . "/templates/default/" . $image_dir . "/" . $img; $skin_img = "." . $module_path . "/templates/default/images/" . $img; } else { if (is_object($styleDefinition) && $current_skin != "default") { $user_img = "./Customizing/global/skin/" . $current_skin . $module_path . "/" . $image_dir . "/" . $img; $skin_img = "./Customizing/global/skin/" . $current_skin . $module_path . "/images/" . $img; } } // temp svg patch /* $pi = pathinfo($img); if ($pi["dirname"] != "") { $pi["dirname"] = $pi["dirname"]."/"; } $svg_img = ".".$module_path."/templates/default/images/".$pi["dirname"].$pi["filename"].".svg"; if (file_exists($svg_img)) { return $svg_img; }*/ if ($offline) { return "./images/" . $img; } else { if (@file_exists($user_img) && $image_dir != "") { return $user_img; // found image for skin and style } else { if (file_exists($skin_img)) { return $skin_img; // found image in skin/images } } } return $default_img; // take image in default }