initialer import von douth-hiphop.de's Entwicklungsstand
This commit is contained in:
commit
9805cf14de
54 changed files with 1237 additions and 0 deletions
39
fetchdescription.php
Normal file
39
fetchdescription.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Holt die Bildinformationen zu einem Bild aus der Datei
|
||||
* content/bilder/imginfo.txt und gibt diese zurueck.
|
||||
*
|
||||
* Copyright (c) 2007 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions,
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
* All rights reserved.
|
||||
*/
|
||||
$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"]));
|
||||
}
|
||||
?>
|
Reference in a new issue