Skip to content

Commit

Permalink
Možnost výběru vlastního náhledu složky galerie (5. řádek v konfigura…
Browse files Browse the repository at this point in the history
…čním souboru)
  • Loading branch information
vsmitka committed Apr 5, 2013
1 parent fd214e4 commit 7a6debf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions gallery/photos/conf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TEST
120
effects
Lorem ipsum
#thumb:adresa vlastni miniatury
----------------
image2.jpg
Druh� obr�zek v po�ad�
1 change: 1 addition & 0 deletions gallery/photos/sub1/conf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ Podslo
120
effects
Prvn� podslo�ka
#thumb:adresa vlastni miniatury
----------------
15 changes: 13 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
$conf_nadpis=(isset($_POST["nadpis"]))?$_POST["nadpis"]:"Galerie";
$conf_height=(isset($_POST["height"]))?$_POST["height"]:"120";
$conf_text=(isset($_POST["text"]))?$_POST["text"]:"";

$conf_mini=(isset($_POST["mini"]))?"thumb:".$_POST["mini"]:"#thumb:url";
fwrite($f,"$conf_nadpis\n");
fwrite($f,"$conf_height\n");
$eff=(isset($_POST["eff"]))?"effects":"noeff";
fwrite($f,"$eff\n");
fwrite($f,"$conf_text\n");
fwrite($f,"$conf_mini\n");
fwrite($f,"----------------\n");
if(isset($_POST["popis"]) && $_POST["popis"]){

Expand Down Expand Up @@ -60,6 +61,7 @@
echo "<input type=\"text\" value=\"Nadpis\" name=\"nadpis\"> :: nadpis galerie<br>";
echo "<input type=\"text\" value=\"120\" name=\"height\"> :: výška miniatur<br>";
echo "<input type=\"text\" value=\"\" name=\"text\"> :: popis galerie<br>";
echo "<input type=\"text\" value=\"\" name=\"mini\"> :: miniatura galerie<br>";
echo "Popisky <input type=\"radio\" value=\"0\" selected=\"selected\" name=\"popis\">nevytváøet";
if (extension_loaded("exif")) echo " <input type=\"radio\" value=\"1\" name=\"popis\">z EXIF";
//echo " <input type=\"radio\" value=\"2\" name=\"popis\"> prùvodce";
Expand Down Expand Up @@ -127,6 +129,7 @@
if (file_exists("$galerie/".$dirs[$i]."/conf.txt")){
$conf=array_map('trim',file("$galerie/".$dirs[$i]."/conf.txt"));
$height=$conf[1];
$dir_min=(preg_match("/^thumb:(.*)/s",$conf[4],$tmp))?$tmp[1]:"";
$mini=$out[2];
if(preg_match("/\[img_(\d+)\]/",$out[2],$param)){
$files=array();
Expand All @@ -137,6 +140,9 @@
closedir($dh);
sort($files);
$index=(!$param[1])?(rand(1,sizeof($files))-1):$param[1]-1;
if($dir_min)
$mini=preg_replace("/\[img_(\d+)\]/","<img src=\"$dir_min\" height=\"$height\" width=\"".($height*$ratio)."\" />",$out[2]);
else
$mini=preg_replace("/\[img_(\d+)\]/","<img src=\"$galerie/".$dirs[$i]."/mini/".$files[$index]."\" height=\"$height\" width=\"".($height*$ratio)."\" />",$out[2]);

}
Expand Down Expand Up @@ -172,7 +178,9 @@
$name="<em>$fold</em>";
if (file_exists("$dir/$fold/conf.txt")){
$conf=array_map('trim',file("$dir/$fold/conf.txt"));
$name=$conf[0];
$name=$conf[0];

$dir_min=(preg_match("/^thumb:(.*)/s",$conf[4],$tmp))?$tmp[1]:"";
}

if(preg_match("/\[img_(\d+)\]/",$out2[2],$param)){
Expand All @@ -184,6 +192,9 @@
closedir($dh2);
sort($files2);
$index=(!$param[1])?(rand(1,sizeof($files2))-1):$param[1]-1;
if($dir_min)
$mini=preg_replace("/\[img_(\d+)\]/","<img src=\"$dir_min\" height=\"$height\" width=\"".($height*$ratio)."\" />",$out2[2]);
else
$mini=preg_replace("/\[img_(\d+)\]/","<img src=\"$dir/$fold/mini/".$files2[$index]."\" height=\"$height\" width=\"".($height*$ratio)."\" />",$out2[2]);

}
Expand Down

0 comments on commit 7a6debf

Please sign in to comment.