Po nacisnięciu na miniaturke, skrypt nie odnajduje obrazka, sama galeria napewno dziala ale ja używam na stronie szblobu php zeby wszystko wyświetlało sie w odpowiedniej komórce, no i miniaturki i wszystko inne dziala, ale gdy klikam na miniaturke aby powiekszyc fotke nic sie nie wyswietla! zmienna $go z szablonu jest pusta nic nie pobiera, jestem poczatkujacym w php wiec prosz o pomoc, z gory dziekuje. Zeby dokladniej zrozumiec w czym problem tutaj ->
http://republika.pl/zdjecia_praca/problem.rar jest spakowana, prymitywna stronka pokazująca ten błąd.
podam jeszcze trsc plików bo może ktoś z "lotu" potrafi mi odpowiedzieć na pytanie.
Plik galeri->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Image Galleria</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
</style>
<!--link rel="stylesheet" href="../style.css" type="text/css"-->
</head>
<body>
<div align="center">
<h2>Image Gallery</h2>
<p>My most favorite pictures ever.</p>
<?
/********** editable variables **********/
// thumbnails title
$thumb_title = 1; // set to 1 if you want the image filename below the thumb, 0 otherwise
// full size images title
$full_title = 1; // set to 1 if you want the image filename below the the full size image, 0 otherw
ise
// how many thumbnails should appear per row?
$cols = 3; // 3 looks the best, but you may want more or less, depending on the size of your
thumbnails
// how many thumbnails per page?
$max_thumbs = 0; // a multiple of $cols looks the best, or 0 for all thumbnails on one page
// thumbnail directory name
$thumbs_dir = "thumbs"; // just make sure your directory name is inside double quotes
// full size image directory name
$full_dir = "images"; // just make sure your directory name is inside double quotes
// captions directory name
$captions_dir = "captions"; // if you don't want captions at all, don't worry about this
// extension name
$ext = "php"; // just incase you are using a different extension name for your script; if your s
erver is not set for "index.$ext to be the index page, put "0".
// captions extension
$cext = "inc"; // use whatever you're comfortable with
// show random option for single page view
$showrand = 0; // to turn it off, switch 1 to 0
// print footer options
$print_footer = "print_footer"; // put in the name of the function you use to print the footer of your page. if you don't use one, just leave it as it is.
/********** end editable variables **********/
// figure out this script's name
$self = $HTTP_SERVER_VARS['PHP_SELF'];
}
// do you have an existing function to close your page? if not, use this default...
if (!function_exists($print_footer)) {
function print_gallery_footer() {
?>
</body>
</html>
<?
}
$print_footer = 'print_gallery_footer';
}
// our error function, cleanly exits the script on user errors
function imgerror($error) {
print "<p><b>$error</b></p>nn"; $print_footer();
}
// get image size function
function gallery_imgsize($image) {
return "width=$size[0] height=$size[1]";
}
// check for directories
imgerror('Directory "'.$thumbs_dir.'" does not exist.');
}
imgerror('Directory "'.$full_dir.'" does not exist.');
}
// get contents of $thumbs_dir
$dir = @opendir($thumbs_dir) or imgerror
('Can't open
' . $thumbs_dir . ' directory
'); $thumbs = array();
while($thumb = readdir($dir)) {
if(preg_match('/(jpg$|jpeg$|gif$|tif$|bmp$|png$)/', $thumb))
array_push($thumbs, $thumb);
}
sort($thumbs);
// lowest displayed image in the array
// use http_get_vars incase register_globals is off in php.ini
if (!isset($HTTP_GET_VARS['i'])) {
$i = 0;
}
else {
$i = $HTTP_GET_VARS['i'];
}
// check to see if all thumbs are meant to be displayed on one page
if ($max_thumbs == 0) {
$max_thumbs = sizeof($thumbs);
$mt_check = 1;
}
else {
$mt_check = 0;
}
// thumbnail view
if (is_numeric($i)) {
// check to see which thumbnail to start with
if (!$mt_check && $i > 0) {
$start = $max_thumbs * ($i - 1);
}
else {
$start = 0;
}
// are they looking for thumbs pages that don't exist?
if ($start > sizeof($thumbs)) { print '<a href="' . $self . '">index</a>' . "nn"; imgerror('Sorry, there are no images to display on this page');
}
?>
<table width="80%" cellspacing=0 cellpadding=10 border=0>
<tr>
<?
// loop through $thumbs and display $max_thumbs per page
for($count = 1; $count <= $max_thumbs; $start++) {
// break if past max_thumbs
if ($start >= sizeof($thumbs)) { break;
}
// print new row after predefined number of thumbnails
if(($count % $cols == 1) && $count != 1 && $cols > 1) {
}
else if ($cols == 1) {
}
// open cell
print '<td align="center" width="' . (floor(100
/ $cols)) . '%">';
// insert thumb
print '<a href="' . $self . '?i=' . rawurlencode("$thumbs[$start]") . '"><img src="' . $thumbs_dir . '/' . rawurlencode("$thumbs[$start]") . '" '; print gallery_imgsize
("$thumbs_dir/$thumbs[$start]");
// alt information
print ' alt="Link to full sized version of ' . $thumbs[$start] . '"></a>';
// image title
if($thumb_title) {
print "n" . '<br>' . $title[0
]; }
// close cell
// supress line break for screen readers, but force a line break for lynx
print '<br style="visibility: hidden; volume: silent"></td>' . "n"; $count++;
}
?>
</tr>
</table>
<?
// thumbs page nav
if (!$mt_check) {
// how many total thumbs pages, including a "remainder" page if needed
for ($count = 1; $count <= $pages; $count++) {
if ($count == 1) {
if ($count == $i || $i == 0) {
}
else {
print "<a href="$self">$count</a>"; }
}
else {
if ($count == $i) {
}
else {
print " | <a href="$self?i
=$count">$count</a>"; }
}
}
}
}
// single image view
// find where it is in the array
$key = -1;
}
// navigation
// previous
if($key >= 1) {
print '<a href="' . $self . '?i=' . rawurlencode($thumbs[$key - 1]) . '">Ť previous</a> | '; }
else {
}
// index
print '<a href="' . $self . '">index</a>'; // random
if ($showrand != 0) {
print ' | <a href="' . $self . '?i=' . rawurlencode($thumbs[$random[0]]) . '">random</a>'; }
// next
if($key != (sizeof($thumbs) - 1
)) { print ' | <a href="' . $self . '?i=' . rawurlencode($thumbs[$key + 1]) . '">next ť</a>'; }
else {
}
// image
print gallery_imgsize
("$full_dir/$i");
// alt information
if(!$full_title) {
}
if($full_title) {
$title = explode(".", str_replace("_", " ", ucfirst($i)));
print "<div class="fulltitle">$title[0]</div>nn";
}
// numerically show what image it is in the series; hide this if image isn't in the series
if ($key >= 0) {
// add 1 so that the first image is image 1 in the series, not 0
print '<div class="series">' . ($key + 1) . ' of ' . sizeof($thumbs) . "</div>nn";
}
// caption (optional)
if (file_exists("$captions_dir/$i.$cext")) {
print '<div class="caption">';
require("$captions_dir/$i.$cext");
print '</div>';
}
}
// no image found
else {
?><p><a href="<?=$self?>">index</a></p>
<?
imgerror('Sorry, that image does not exist...');
}
?>
<p><a href="../">Back to main image gallery</a></p>
</div>
</body>
</html>
</body>
</html>
Treśc szablonu ->
<?php
// zmienna $go przekazana metoda GET
$go = $_GET['go'];
// sprawdzamy czy zmienna $go nie jest pusta
// sprawdzamy czy plik o danej nazwie istnieje
if(is_file("./include/$go.php")) include "./include/$go.php"; // jezeli plik nie istnieje wyswietla się komunikat
else echo "<br />Nie ma takiej strony :-("; }
// jezeli zmienna $go jest pusta wyswietla się strona glowna
else include "start.php";
?>
i pytanie to samo dlaczego po nacisnięciu na miniaturke skrypt nie znajduje pełnej fotki chociaż fizycznie ona jest, gdy do galeri odwołam sie bezpośrednio bez szblonu strony wszystko jest ok.
Ten post edytował tomorek 2.08.2006, 12:54:02