2008-08-26 15:10:33 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Holt die Bildinformationen zu einem Bild aus der Datei
|
2008-08-26 16:02:43 +02:00
|
|
|
* bilder/imginfo.txt und gibt diese zurueck.
|
2008-08-26 15:10:33 +02:00
|
|
|
*
|
2008-08-26 16:02:43 +02:00
|
|
|
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
2008-08-26 15:10:33 +02:00
|
|
|
* Jan Dittberner IT-Consulting & -Solutions,
|
|
|
|
* Cottbuser Str. 1, D-01129 Dresden
|
2008-08-26 22:27:24 +02:00
|
|
|
*
|
|
|
|
* This file is part of the ScrollingJQueryGallery component of the
|
|
|
|
* gnuviech-server.de Websitetools
|
|
|
|
*
|
|
|
|
* ScrollingJQueryGallery is free software: you can redistribute it
|
|
|
|
* and/or modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* ScrollingJQueryGallery is distributed in the hope that it will be
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with ScrollingJQueryGallery. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2008-08-26 16:02:43 +02:00
|
|
|
*
|
|
|
|
* Version: $Id$
|
2008-08-26 15:10:33 +02:00
|
|
|
*/
|
|
|
|
$infofile = "bilder/imginfo.txt";
|
|
|
|
$prefix = "bilder/";
|
|
|
|
|
|
|
|
function getImgInfo($imagename) {
|
|
|
|
if (file_exists($imagename)) {
|
|
|
|
$imagename = substr($imagename, strlen($GLOBALS["prefix"]));
|
|
|
|
}
|
|
|
|
if (file_exists($GLOBALS["prefix"] . $imagename)) {
|
|
|
|
foreach (file($GLOBALS["infofile"]) as $line) {
|
|
|
|
$firstspace = strpos($line, " ");
|
|
|
|
$name = substr($line, 0, $firstspace);
|
|
|
|
$data = trim(substr($line, $firstspace + 1));
|
|
|
|
if (strcmp($name, $imagename) == 0) {
|
|
|
|
$retval = array("name" => $name,
|
|
|
|
"data" => trim($data));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return $GLOBALS["prefix"] . $imagename . " doesn't exist";
|
|
|
|
}
|
|
|
|
return $retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["imagename"])) {
|
|
|
|
header("Content-Type: text/plain; charset=UTF-8");
|
|
|
|
print json_encode(getImgInfo($_GET["imagename"]));
|
|
|
|
}
|