Autor Zpráva
maestorm
Profil
Dobrý den,
mám problém se skriptem, který by měl zobrazovat náhledy, ale nezobrazuje je, protože jsem omylem smazal původní soubor titles.txt, potřeboval bych ho obohatit o soubory náhledů což je např.: IM006290_tn.jpg, ale nevím jak to do toho souboru titles.txt zapsat, aby je to zobrazovalo, doufám, že mi rozumíte.
soubory nutné k pochopení najdete zde:
http://www.atelier.wz.cz/includes/gallery.php
http://www.atelier.wz.cz/includes/title.php
http://www.atelier.wz.cz/index.php
nebo Vám je dám rovnou sem:
gallery.php
<?php

// PHP Gallery Navigation Script: Configuration set in index.php
echo "
<div id='gallery'>";
//starting variable
$y = 0;
// open file and set into array of thumbnails
// append _tn to end of file name to access thumbnails
// thumbnails must be have:
// 		identical file names to full size images
// 		no periods
//		same file type as full size images 
$fp = fopen($piclist, 'r');
 while ($buffer= fgets($fp,4096)) {
	$image[$y] = explode("|", $buffer); 
	$photo[$y] = str_replace(".", "_tn.", $image[$y][0]);
	$y++;
	} 
// calculate total number of images
$result = count($photo);	
$pages = intval($result/$num_per_page);
if ($result%$num_per_page != 0) {
$pages++;
}
// numeric value of final image where initial image = 0	   
$suma = ($result-1); 
// calculate image values based on currently viewed image
if (isset($_GET['a'])) {
    if (is_numeric($_GET['a'])) {
    $newa=$_GET['a']; 
    } else {
    $newa=1;
    }
$current_page = (($newa+1)%$num_per_page) ? intval(($newa+1)/$num_per_page)+1 : intval(($newa+1)/$num_per_page);
$prev = ($newa-1); 
$next = ($newa+1); 
switch ($newa) {
	case 0:
		$prev = $suma;
		$next = 1; 
		break;
	case $suma:
		$prev = ($suma - 1);
		$next = 0;
		break;
}
// display navigation links for image gallery  
// if "a" is set in the $_GET array:
if ($display_image_nav == "above") {
	echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_above\">\n<p><a href='?a=$prev'>$previous_text</a>$separator<a href=\"?a=$next\">$next_text</a></p>\n";	
		if ($skip_text != "") {
		echo "\n<p><small><a href=\"#thumbs\">$skip_text</a></small></p>\n";
		}
	echo "</div>";		
}	
	} else {
	$current_page = 1;
if ($display_image_nav == "above") {	
	// if "a" is NOT set:
	echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_above\">\n<p><a href='?a=$suma'>$previous_text</a>$separator<a href=\"?a=1\">$next_text</a></p>
	";
		if ($skip_text != "") {
		echo "\n<p><small><a href=\"#thumbs\">$skip_text</a></small></p>\n";
		}
	echo "</div>";
	}
}	
echo "\n<div class=\"gallery_description\">\n<h$header>$gallery_title</h$header>\n<p>$description</p>\n</div>";

// display current full sized image if get value is set
if (isset($_GET['a'])) {
    if (is_numeric($_GET['a'])) {
    $a = $_GET['a'];
    } else {
    $a = 1;
    }
$display = $image[$a][0]; 
$description = $image[$a][1]; 
$alt = $image[$a][2];
echo "\n<div id=\"full_image\">";
    if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; }
 echo "\n<p><img src=\"$path/$display\" alt=\"";if($alt_text==TRUE){echo $alt;}echo"\" /></p>";
    if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; }
} else {
// display first image if no get value is set
$display = $image[0][0]; 
$description = $image[0][1];
$alt = $image[0][2];

echo "\n<div id='full_image'>";
    if ($caption_text_over == TRUE) { echo "\n<p class=\"caption_text_over\">$description</p>"; }
 echo "\n<p><img src='$path/$display' alt='";if($alt_text==TRUE){echo$alt;}echo"' /></p>";
    if ($caption_text_under == TRUE) { echo "\n<p class=\"caption_text_under\">$description</p>"; }
	
} 
echo "\n</div>";


// display thumbnails in unordered list format
echo "
<div id='thumbs'>";
if ($display_thumbs_header == TRUE) {
echo "\n<h";
echo $header+1;
echo ">$thumbnails_text</h";
echo $header+1;
echo ">";
}
echo "\n<ul>";

$start = (($current_page-1)*$num_per_page);
$finish = ($start + $num_per_page)-1;

if ($finish > ($result - 1)) {
$finish = $result - 1;
}


for ($i = $start; $i <= $finish; $i++){
  	if(is_file($path.'/'.$photo[$i])) {
		$alt = $image[$i][2];
		if ($i == $a) { $current = " class='current_image'"; } else { $current = ""; }
		echo "\n<li$current><a href='?a=$i'><img src='$path/$photo[$i]' alt='$alt' /></a></li>";
   		}
}
echo "\n</ul></div>"; 

if (isset($_GET['a'])) {
if ($display_image_nav == "below") {
	echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href='?a=$prev'>$previous_text</a>$separator<a href=\"?a=$next\">$next_text</a></p>\n";	
		if ($skip_text != "") {
		echo "\n<p><small><a href=\"#thumbs\">$skip_text</a></small></p>\n";
		}
	echo "</div>";		
}	
	} else {
	$current_page = 1;
if ($display_image_nav == "below") {	
	// if "a" is NOT set:
	echo "\n<div id=\"gallery_nav\" class=\"gallery_nav_below\">\n<p><a href='?a=$suma'>$previous_text</a>$separator<a href=\"?a=1\">$next_text</a></p>
	";
		if ($skip_text != "") {
		echo "\n<p><small><a href=\"#thumbs\">$skip_text</a></small></p>\n";
		}
	echo "</div>";
	}	

}

if ($display_pagination == TRUE) {
echo "\n<div id=\"page_list\"><ul>";
	for($i=0;$i < $pages;$i++) {
	$image = $i * $num_per_page;
	$page_number = $i+1;
		if ($page_number == $current_page) {
		echo "\n<li class=\"current_page\" title=\"Current Page\">$page_number</li>";
		} else {
		echo "\n<li><a href=\"?a=$image\" title=\"$gallery_title, page $page_number\">$page_number</a></li>";	
		}
	}
echo "\n</ul></div>";
}
?>

title.php
<?php

$y = 0;
// open file and set into array of thumbnails
// append _tn to end of file name to access thumbnails
// thumbnails must be have:
// 		identical file names to full size images
// 		no periods
//		same file type as full size images 
$fp = fopen($piclist, 'r');
 while ($buffer= fgets($fp,4096)) {
	$image[$y] = explode("|", $buffer); 
	$photo[$y] = str_replace(".", "_tn.", $image[$y][0]);
	$y++;
	} 
if (isset($_GET['a'])) {
    if (is_numeric($_GET['a'])) {
    $a = $_GET['a'];
    } else {
    $a = 1;
    }
	if ($description_title == TRUE) {
	$img_title = $image[$a][1]; 
	} else if ($alt_title == TRUE) {
	$img_title = $image[$a][2];
	}

	} else {
	// display first image if no get value is set
	if ($description_title == TRUE) {
	$img_title = $image[0][1]; 
	} else if ($alt_title == TRUE) {
	$img_title = $image[0][2];
	}

	}
$title_element = $gallery_title . $sep . $img_title . $sep . $sitename;
echo "<title>$title_element</title>";
?>

index.php
<!DOCTYPE html lang="cs
    
maestorm
Profil
index.php
<!DOCTYPE html lang="cs">
  <head>
    <title>Atelier a internetová galerie umìlce Petra Biliny</title>
    <meta http-equiv="Content-Language" content="cs" /> 
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> 
    <link rel="stylesheet" type="text/css" title="styles" href="styles.css" />
    <?php 
//THE SCRIPT//
/*************************************/
// Configuration                     //
/*************************************/
// Labels for Image Gallery Titles:
$sitename = "";
$sep = " - "; // title element separator

// relative path to image folder 
$path = "photos"; 
// Number of thumbnail images displayed per page
$num_per_page = 98; 
// title of this gallery
$gallery_title = "";
// text description of this gallery
$description = ""; //optional


// This controls the heading preceding the thumbnails group.
$thumbnails_text = "náhledy";
$display_thumbs_header = TRUE;

// Controls the display of the list of links to successive pages of the gallery.
$display_pagination = TRUE;

// Pick which field will supply unique title element text.
// "TRUE" field is the source for the title element.
$description_title = TRUE;
$alt_title = FALSE;

// heading level of gallery header [e.g. <h1>, <h2>] (string, 1-6);
$header = "2";

// path + name of image index file (you can name the index
// file whatever you want, just put that name here!)
$piclist = "photos/titles.txt";  

// Leave this set to TRUE if you want to include the description
// text for the image in a paragraph underneath the image.
$caption_text_under = TRUE;
// Ditto, except that the caption would be above the image.
$caption_text_over = FALSE;

// Do you want to include an alternative text attribute on the 
// full size images?  If you've left the description/caption turned on,
// it may be preferable to disable the alternative text on these images.
$alt_text = FALSE;


// Whether the "previous" and "next links are visible, and above or below the full-sized image.
$display_image_nav = "below"; 
#display_image_nav = "above";
#$display_image_nav = TRUE;

// String separating the "previous" and "next" links
$separator = " &bull; ";
$previous_text = "Previous";
$next_text = "Next";

// You can disable the skip link by setting this text to "";
$skip_text = "";

// Do you want to give me your public thanks?  Hey! That's cool! Not required, though.
$attribution = FALSE;

$version = "1.2";
/***********************************/
// End Configuration               //
/***********************************/
include("includes/title.php");
?>
  </head>
<body>
<div id="hidden">
</div>
<article>
  <header>
    <a href="http://www.atelier.wz.cz"><h1></h1></a> 
  </header>
  <section>
    <h4>O autorovi</h4><img id="photography" src="foto.jpg" />
      <p class="left_text"></p>

      <?php
include("includes/gallery.php");
// END THE GALLERY SCRIPT//
?>
  </section>
</article>
<footer>
<nav>
<div id="music_block">
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNTcxMDYwNDczNjMmcHQ9MTI1NzEwNjA1NTM4NiZwPTE4MDMxJmQ9Jmc9MSZvPWZlYjA5ZWUyMzA2YzRhZTdhYTI5OGE1NmE*Mjk4OTEw.gif" /><center><p style="visibility:visible;"><object type="application/x-shockwave-flash" data="http://assets.myflashfetish.com/swf/mp3/mff-txtzoom.swf" height="128" width="220" style="width:220px;height:128px"><param name="movie" value="http://assets.myflashfetish.com/swf/mp3/mff-txtzoom.swf" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="salign" value="TL" /><param name="wmode" value="transparent"/><param name="flashvars" value="myid=33666997&path=2009/10/31&mycolor=7a5849&mycolor2=1f180f&mycolor3=e0dfd3&autoplay=false&rand=1&f=4&vol=27&pat=0&grad=false&ow=220&oh=128"/></object>
</div>
</nav>
</footer>
</body>
</html>

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0