Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: [php] Galeria
Forum PHP.pl > Forum > Przedszkole
shaggard
Witam

Otoz wlasnie robie stronke i jestem na etapie galerii. No i mam problem z wyswietlaniem miniatur . Przegladnalem skrypt kilka razy i nic. Na co zwrocic uwage w skrypcie? Pomocy! sad.gif

pozdrawiam
JaRoPHP
Widzê, ¿e Twoja wiara w jasnowidzów jest ogromna smile.gif
Jaki skrypt przegl±dasz? Przecie¿ u¿ytkownicy nie znaj± wszystkich skryptów - warto pokazaæ jego zawarto¶æ.

Jedyna uwaga - mam nadziejê, ¿e miniatury nie s± robione przez ten skrypt.
shaggard
ups rzeczywiscie sorry zapomnialem smile.gif
oto skrypt:
  1. <?php
  2.  
  3. $imgdir = $_GET['imgdir'] ; 
  4. $page = $_GET['page'];
  5. $a_img = array();
  6. include("header.inc");
  7. require('config.php');
  8. if ($rollover)
  9. {
  10. include('rollover.txt');
  11. }
  12.  
  13. ///// for captioning
  14.  
  15. function caption($filename) {
  16. $is_captioned = check_perms($filename);
  17. if ($is_captioned) {
  18. print"<br><font face='Arial, Helvetica, sans-serif' size=2 color='#999999'>";
  19. include($filename);
  20. print"</font>";
  21. }
  22. }
  23.  
  24. ///// for album description
  25.  
  26. function album($filename) {
  27. $is_captioned = check_perms($filename);
  28. if ($is_captioned) {
  29. print"<font face='Arial, Helvetica, sans-serif' size=3 color='#cccccc'>";
  30. include($filename);
  31. print"</font><br>";
  32. }
  33. }
  34.  
  35. ////check file permission
  36.  
  37. function check_perms($filename) {
  38. if (! file_exists($filename)) return false;
  39. $fileperms = fileperms($filename);
  40. $isreadable = $fileperms & 4;
  41. if ( is_file($filename) ) {
  42.  
  43. // pictures, thumbnails, config files and comments only need to be readable
  44.  
  45. if (! $isreadable) {
  46. if (MODE_WARNING) print "$filename: wrong permission <br>";
  47. }
  48. return $isreadable;
  49. }
  50. else if ( is_dir($filename) ) {
  51.  
  52. // galleries need to be both readable and executable
  53.  
  54. $isexecutable = $fileperms & 1;
  55. if (! $isreadable || ! $isexecutable)
  56. if (MODE_WARNING) print "$filename: wrong permission <br>";
  57. return ( $isreadable && $isexecutable); // ($dirperms & 5) == 5 ?
  58. }
  59.  
  60. // default behavior: the filename does not exist
  61.  
  62. return false;
  63. }
  64. $dh = opendir($dir);
  65. while($file = readdir($dh))
  66. {
  67. if ($file != "." && $file != ".." && is_dir($file))  
  68. {$dname[] = $file;
  69. sort($dname);
  70. reset ($dname);
  71.  }
  72. }
  73. print "<script language="JavaScript">";
  74. print "function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");";
  75. print " if (restore) selObj.selectedIndex=0;}";
  76. print "</script>";
  77. print "<form name="form1">";
  78. print "<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">";
  79. print "<option value="#">Wybierz</option><br>n";
  80. $u=0;
  81. foreach($dname as $key=>$val)
  82. { if($dname[$u])  
  83. { print "<option value="index.php?imgdir=$dname[$u]">$dname[$u]</option>n";
  84. $u++;
  85. }
  86. }
  87. print "</select>";
  88. if ($imgdir =="")
  89. {$imgdir = $dname[0];
  90. }
  91. $dimg = opendir($imgdir);
  92. while($imgfile = readdir($dimg))
  93. {
  94. if( (substr($imgfile,-3)=="gif") || (substr($imgfile,-3)=="jpg") || (substr($imgfile,-3)=="JPG") || (substr($imgfile,-3)=="GIF") )
  95. {
  96. $a_img[count($a_img)] = $imgfile;
  97. sort($a_img);
  98. reset ($a_img);
  99. } 
  100. }
  101.  
  102. //print "<h2>$imgdir</h2>";
  103.  
  104. $totimg = count($a_img); // total images number
  105. $totxpage = $col*$maxrow; // images x page
  106. $totpages = ($totimg%$totxpage==0)?((int)$totimg/$totxpage):((int)($totimg/$totxpage)+1); // number of total pages
  107. if($totimg == false)
  108. print "<br><font size=2 face=verdana></font><br>";
  109. else
  110. {
  111. print "</form>";
  112.  
  113. ///print album description
  114.  
  115. $album_name = "$imgdir/album.txt";
  116. album($album_name);
  117. print "<table width=600 border=3 bordercolor=#663300 cellpadding=2 cellspacing=3 align=center>n";
  118. // start page
  119. if($page=="" || $page==1)
  120. {
  121. $x=0;
  122. $page = 1;
  123. }
  124. else
  125. $x = (($page-1)*($totxpage));
  126. $r=0;
  127. // print of table
  128. foreach($a_img as $key=>$val)
  129. {
  130. $caption_name = "$imgdir/$a_img[$x].txt";
  131. if(($x%$col)==0)
  132. print "<tr>n";
  133. if($a_img[$x])
  134. {
  135. $size = getimagesize ("$imgdir/$a_img[$x]");
  136. $halfw = round($size[0]/2);
  137. $halfh = round($size[1]/2);
  138. $quarterw = round($size[0]/4);
  139. $quarterh = round($size[1]/4);
  140. if($size[1] < $size[0])
  141. {
  142. $height = 86;
  143. $width = 130;
  144. $imgnumber = ($x+1);
  145. if("$imgdir/$a_img[$x]" !="")
  146. if ($thumb){
  147. $thumbnail = "thumbs.php?image=$imgdir/$a_img[$x]&newheight=86&newwidth=130&width=$size[0]&height=$size[1]";
  148. }
  149. else 
  150. {
  151. $thumbnail = "$imgdir/$a_img[$x]";
  152. }
  153. print "<td align=center valign=top>";
  154. print "<TABLE WIDTH=168 BORDER=0 CELLPADDING=0 CELLSPACING=0>";
  155. print "<TR><TD COLSPAN=1></TD></TR>";
  156. print "<TR><TD></TD></TR><br>";
  157. print "<TD><a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$size[0]&h=$size[1]&t=$imgdir $imgnumber','$x','width=$size[0],height=$size[1],directories=no,location=no,menubar=no,scrollbars=
    no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank"><img src="$thumbnail" height=$height width=$width border=0 alt='$a_img[$x]' style="filter:alpha(opacity=100)" onmouseout="gradualfade(this,100,30,4)" onmouseover="gradualfade(this,40,50,100)"></a></TD>";
  158. print "<TD></TD><TR></TR>";
  159. print "<TD COLSPAN=1><font size="1"><center><a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$size[0]&h=$size[1]&t=$imgdir $imgnumber','$x','width=$size[0],height=$size[1],directories=no,location=no,menubar=no,scrollbars=
    no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank">$size[0] x $size[1]</a> | <a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$halfw&h=$halfh&t=$imgdir $imgnumber','$x','width=$halfw,height=$halfh,directories=no,location=no,menubar=no,scrollbars=no,s
    tatus=no,toolbar=no,resizable=no'
    );return false" target="_blank">1/2</a> | <a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$quarterw&h=$quarterh&t=$imgdir $imgnumber','$x','width=$quarterw,height=$quarterh,directories=no,location=no,menubar=no,scrollbar
    s=no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank">1/4</a></font></center>";
  160. caption($caption_name);
  161. print "</TD></TR>";
  162. print "</TABLE></center>";
  163. print "</td>n";
  164. }
  165. else
  166. {
  167. $height = 130;
  168. $width = 86;
  169. if ($thumb){
  170. $thumbnail = "thumbs.php?image=$imgdir/$a_img[$x]&newheight=130&newwidth=86&width=$size[0]&height=$size[1]";
  171. }
  172. else 
  173. {
  174. $thumbnail = "$imgdir/$a_img[$x]";
  175. }
  176. $imgnumber = ($x+1);
  177. if("$imgdir/$a_img[$x]" !="")
  178. print "<td align=center valign=top>";
  179. print "<TABLE WIDTH=168 BORDER=0 CELLPADDING=0 CELLSPACING=0>";
  180. print "<TR><TD COLSPAN=1></TD></TR>";
  181. print "<TR><TD></TD></TR><br>";
  182. print "<TD><a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$size[0]&h=$size[1]&t=$imgdir $imgnumber','$x','width=$size[0],height=$size[1],directories=no,location=no,menubar=no,scrollbars=
    no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank"><img src="$thumbnail" height=$height width=$width border=0 alt='$a_img[$x]' style="filter:alpha(opacity=100)" onmouseout="gradualfade(this,100,30,4)" onmouseover="gradualfade(this,40,50,100)"></a></TD>";
  183. print "<TD COLSPAN=1><br><font size="1"><a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$size[0]&h=$size[1]&t=$imgdir $imgnumber','$x','width=$size[0],height=$size[1],directories=no,location=no,menubar=no,scrollbars=
    no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank">$size[0] x $size[1]</a> | <a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$halfw&h=$halfh&t=$imgdir $imgnumber','$x','width=$halfw,height=$halfh,directories=no,location=no,menubar=no,scrollbars=no,s
    tatus=no,toolbar=no,resizable=no'
    );return false" target="_blank">1/2</a> | <a href='#' onclick="window.open('popup.php?img=$imgdir/$a_img[$x]&w=$quarterw&h=$quarterh&t=$imgdir $imgnumber','$x','width=$quarterw,height=$quarterh,directories=no,location=no,menubar=no,scrollbar
    s=no,status=no,toolbar=no,resizable=no'
    );return false" target="_blank">1/4</a></font>";
  184. caption($caption_name);
  185. print "</TD></TR>";
  186. print "</TABLE>";
  187. print "</td>n";
  188. }  
  189. }
  190. if(($x%$col) == ($col-1))
  191. {
  192. print "</tr>n";
  193. $r++;
  194. }
  195.  
  196. // print "r=$r - maxrow=$maxrow<br>";
  197.  
  198. if($r==$maxrow)
  199. {
  200. break;
  201. }
  202. else
  203. $x++;
  204. }
  205. print "</table>n";
  206. }
  207.  
  208.  // page break
  209.  
  210. $imgdir = str_replace(" ", "%20", $imgdir); 
  211.  
  212. //page number
  213.  
  214. print "<p><font size=2 face=verdana>";
  215. if($totimg>$totxpage)
  216. {
  217. if($totpages>$page)
  218. {
  219. $next = $page+1;
  220. $back = ($page>1)?($page-1):"1";
  221. if($page>1)
  222. {
  223. $back = $page-1;
  224. print "<a href=index.php?imgdir=$imgdir&page=1>dalej</a> | 
  225. <a href=index.php?imgdir=$imgdir&page=$back><< cofnij </a>";
  226. }
  227. print "<b>strona $page z $totpages</b> <a href=index.php?imgdir=$imgdir&page=$next>dalej >></a> | <a href=index.php?imgdir=$imgdir&page=$totpages>ostatnia strona</a>";
  228. }
  229. else
  230. {
  231. $next = (($page-1)==0)?"1":($page-1);
  232. print "<a href=index.php?imgdir=$imgdir&page=1>pierwsza strona</a> | 
  233. <a href=index.php?imgdir=$imgdir&page=$next><< cofnij</a>  <b>strona $page z $totpages</b>  ";
  234.  
  235. print "</center>";
  236. }
  237.  }
  238. include("footer.inc");
  239. ?>


pozdrawiam
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.