i'm very new to this.
basically this script creates a gallery where the thumbnails link to change the content of a div so a bigger picture appear in the div.
I'm only attempting to link the thumbnail directly to the big picture.
so instead of the thumbnail link being
http://www.mysite.com/gallery.php?a=1
http://www.mysite.com/gallery.php?a=2
etc...
i want the link to be
http://www.mysite.com/images/picture.jpg
here is my problem .
this work (link directly to the thumbnail image as a test)
(modifying line 125 below in the full php attached)
Code: Select all
echo "\n<li$current><a href='$path/$photo[$i]'><img src='$path/$photo[$i]' alt='$alt' /></a></li>";http://www.mysite.com/images/picture_tn.jpg
this doesn’t work (attempt to link at the bigger image)
Code: Select all
echo "\n<li$current><a href='$path/$image[$i]'><img src='$path/$photo[$i]' alt='$alt' /></a></li>";all kind of different combinations but i guess i’m just on the wrong track here.
I'm very new to this and been struggling for a while now.
Please help me out if you can. thanks!!!
here is the entire php.
Code: Select all
<?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>";
}
if ($attribution == TRUE) {
echo "\n\n<p><small><a href='http://www.joedolson.com/articles/2007/03/easy-php-photo-gallery/'>Easy PHP Photo Gallery $version by Joseph C Dolson</a>.</small></p>";
} else {
echo "\n\n<!--<p><small><a href='http://www.joedolson.com/articles/2007/03/easy-php-photo-gallery/'>Easy PHP Photo Gallery $version by Joseph C Dolson</a>.</small></p>-->";
}
?>