Archived
1
0
Fork 0

Funktion getImgInfo() zu getImageInfo() und Key ''data'' im

Rückgabewert in ''label'' umbenannt (fixes #30)
This commit is contained in:
Jan Dittberner 2008-08-28 20:06:19 +00:00
parent e756510d21
commit 098528cb41
3 changed files with 6 additions and 8 deletions

View file

@ -37,7 +37,7 @@ if (isset($_GET["imagename"]) && isset($_GET["galleryname"]) &&
preg_match('/^[\w\d _-]+\.jp(e|)g$/', $_GET["imagename"]) && preg_match('/^[\w\d _-]+\.jp(e|)g$/', $_GET["imagename"]) &&
preg_match(GALLERY_RE, $_GET["galleryname"])) { preg_match(GALLERY_RE, $_GET["galleryname"])) {
header("Content-Type: text/plain; charset=UTF-8"); header("Content-Type: text/plain; charset=UTF-8");
if ($imageInfo = getImgInfo($_GET["galleryname"], $_GET["imagename"])) { if ($imageInfo = getImageInfo($_GET["galleryname"], $_GET["imagename"])) {
print json_encode($imageInfo); print json_encode($imageInfo);
} else { } else {
header("HTTP/1.0 404 Not Found"); header("HTTP/1.0 404 Not Found");

View file

@ -95,14 +95,12 @@ function getGalleryConfig($galleryname = null) {
* @li @a data Label des Bildes * @li @a data Label des Bildes
* @li @a preview relative URL des Vorschaubildes * @li @a preview relative URL des Vorschaubildes
* @li @a full relative URL des Vollbildes * @li @a full relative URL des Vollbildes
*
* @bug @a data sollte @a label heißen
*/ */
function getImgInfo($galleryname, $imagename) { function getImageInfo($galleryname, $imagename) {
$label = getImageLabel($galleryname, $imagename); $label = getImageLabel($galleryname, $imagename);
$gallerylabel = getGalleryLabel($galleryname); $gallerylabel = getGalleryLabel($galleryname);
return array("name" => $imagename, return array("name" => $imagename,
"data" => $label, "label" => $label,
"preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR . "preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR .
getScaledImage($galleryname, $imagename, getScaledImage($galleryname, $imagename,
$GLOBALS["previewwidth"], false), $GLOBALS["previewwidth"], false),

View file

@ -55,11 +55,11 @@ function updateContentImage(pathParts) {
"imagename" : pathParts.filename, "imagename" : pathParts.filename,
"galleryname" : pathParts.gallery "galleryname" : pathParts.gallery
}, function(data, textStatus) { }, function(data, textStatus) {
$("#imagedescription").text(data["data"]); $("#imagedescription").text(data["label"]);
$("#content_main img").attr("alt", data["data"]); $("#content_main img").attr("alt", data["label"]);
$("#content_main img").attr("src", data["preview"]); $("#content_main img").attr("src", data["preview"]);
$("#content_main a").attr("href", data["full"]); $("#content_main a").attr("href", data["full"]);
$("#content_main a").attr("title", data["data"]); $("#content_main a").attr("title", data["label"]);
document.title = data["title"]; document.title = data["title"];
}); });
} }