<? //////////////////////////////////////////////////////////////////////////////////////////////////////// // // Configuration Variables // ====================== // // scale : weather or not to scale the large img to the max height/width if it // does not exceed the max height/width limits // 0=don't scale 1=scale // maxwidth : the maximum allowed width of the large picture // maxheight : the maximum allowed height of the large picture // thumbmaxw : the maximum allowed width of the thumbnail // thumbmaxh : the maximum allowed height of the thumbnail // imgperpage : the number of thumbnail images displayed // its best to give this a value that is a multiple of imgperrow // imgperrow : the number of thumbnail images per row // pgperrow : the number of page links per row // typelist : array that contains the imagetypes shown by the browser // currentdir : default the directory where this php file resides, // can be replaced by any directory of your choice // title : enter the title of your page here // home : enter path to your home directory or any other desired director
y // (where the home link goes to) // this_page : the name of this file, $_SERVER['PHP_SELF'] should work, but if it dosen't // just use the file name; this is where all the links to this age go // captionext : filename extension placed on caption file with same name // as image. (ie - <image>.<ext>.<captionext>) // example: image file sunrise.jpg would use the caption // file sunrise.jpg.txt with the default captionext // caption : default caption to place under files if no caption file // exists // stylesheet : enter the path to your stylesheet here // you may enter just '' to use the default(will embed it in the html) // you may also enter 'none' to have no style sheet // the stylesheet should have these classes: // // .imag { border-style : solid; // border-color: blue; // border-width : 1px;} // .thumb { border-style : solid; // border-color: #999999; // border-width : 2px;} // A:link { color: #999999; // text-decoration : none; } // A:visited { color: #999999; // text-decoration : none; } // A:hover { color:blue; } // any of these classses can be adjusted to your needs // // // USAGE: // to browse through the images use the back and forward images // click on one of the thumbnails // or use one of the pagelinks to go directly to another set of images // clicking on the large image will give you the full image ///////////////////////////////////////////////////////////////////////////////////////////////////////// //---Variables--- $scale = 1; $maxwidth = 320; $maxheight = 240; $thumbmaxw = 50; $thumbmaxh = 50; $imgperpage = 10; $imgperrow = 5; $pgperrow = 10; $stylesheet = \"slavo.css\"; $home = \"{$_SERVER['PHP_SELF']}\"; $this_page = \"{$_SERVER['PHP_SELF']}\"; $caption = \"\"; $captionext = \"txt\"; //--- ind is put to zero when the script is first called uppon--- $_GET['ind'] = 0; $index = $_GET['ind']; //---the following code iterates through the directory and puts any image found in th imagelist array--- $extention = $extention[$extfield]; } } } ?> <table align=\"center\" border=\"0\"> <tr> <td> <? if($index-1 >= 0) {?> <a href='<?= $this_page ?>?ind=<?= $index-1 ?>'>[ prev ]</a> <? } ?> </td> <td> <? //--- This is where the large pictures are resized so that they maintain ratio--- $imgwidth = $sizeee[0]; $imgheight = $sizeee[1]; if ($scale == 1 || $imgwidth > $maxwidth || $imgheight > $maxheight) { // decide if img needs to be scaled $newwidth = $imgwidth/($imgheight/$maxheight); $newheight = $imgheight/($imgwidth/$maxwidth); if ($imgwidth < $imgheight) { if ($newwidth > $maxwidth) { ?> <a href=\"<?= $imagelist[$index] ?>\" target=\"_blank\"> <img src=\"<?= $imagelist[$index] ?>\" width=\"<?= $maxwidth ?>\" height=\"<?= $newheight ?>\" alt=\"\" /> </a> <? } else { ?> <a href=\"<?= $imagelist[$index] ?>\" target=\"_blank\"> <img src=\"<?= $imagelist[$index] ?>\" width=\"<?= $newwidth ?>\" height=\"<?= $maxheight ?>\" alt=\"\" /> </a> <? } } else { if ($newhight > $maxheight) { ?> <a href=\"<?= $imagelist[$index] ?>\" target=\"_blank\"> <img src=\"<?= $imagelist[$index] ?>\" width=\"<?= $newwidth ?>\" height=\"<?= $maxheight ?>\" alt=\"\" /> </a> <? } else { ?> <a href=\"<?= $imagelist[$index] ?>\" target=\"_blank\"> <img src=\"<?= $imagelist[$index] ?>\" width=\"<?= $maxwidth ?>\" height=\"<?= $newheight ?>\" alt=\"\" /> </a> <? } } } else { ?> <a href=\"<?= $imagelist[$index] ?>\" target=\"_blank\"> <img src=\"<?= $imagelist[$index] ?>\" width=\"<?= $imgwidth ?>\" height=\"<?= $imgheight ?>\" alt=\"\" /> </a> <? } ?> </td> <td> <a href=\"<?= $this_page ?>?ind=<?= $index+1 ?>\">[ next ]</a> <? } ?> </td> </tr> <tr> <td> </td> <td> <center><? include $imagelist[$index]. \".\" . $captionext; else </center> </td> <td> </td> </tr> </table>
Znalazlem taki oto gotowy skrypcik.. jest spoko.. problem w tym ze dziala poprawnie tylko wowczas kiedy pliki graficzne umieszczone sa w tym samym katalogu co on.. ja natomiast includuje go sobie na stronie z innego katalogu i chcialem zeby czytal zdiecia z katalogu podanego w $currentdir. Jednak tak sie nie dzieje.. zglasza tylko blad, ktory znika w momencie kiedy wgra sie pliki do katalogu ze skryptem..
NA PRAWDE NIKT NIE MA ZADNEJ KONCEPCJI? ;/