RaitisRR Posted January 4, 2007 Report Share Posted January 4, 2007 Sveiki velejos lugt paliidzibu vai kadz nevar pateikt vai iedot kadu skritu paraugam - man vajg lai php izdrukatu visas bildes kas atrodas kada konkreta mapee!! ludzu pastastiet ka lai to izdara ! tnx jau ieprieksh Link to comment Share on other sites More sharing options...
v3rb0 Posted January 4, 2007 Report Share Posted January 4, 2007 saliec kopaa http://php.net/readdir http://lv2.php.net/manual/en/language.cont...l-structures.if http://php.net/echo Link to comment Share on other sites More sharing options...
apophis Posted January 4, 2007 Report Share Posted January 4, 2007 (edited) Kaut kur agrāk šo dabūju, izmantojot kā paraugu, uztaisīju savu galeriju. Galerija <?php $thumb = "images"; // Thumbiņu direkcija $thumbwidth = 160; // Thumbiņa horizontālais izmērs $imagequality = 100; // Thumbiņa kvalitāte % $cols = 4; // Kolumiņas $startrow=1; //rinda no kuras saak raadiit $rowcount=3; //rindu skaits $filelist = false; // Rādīt failu sarakstu [true/false] $bildiic = true; // Rādīt bildīšu thumbiņus [true/false] if ($filelist){ $dir = opendir("./"); while (($g = readdir($dir)) !== false) { if (($g != ".")&&($g != "..")&&($g != "index.php")&&($g != $thumb)){ ?> <a href="<?php echo $g; ?>"><?php echo $g; ?></a><br /> <?php }; }; closedir($dir); }; ?> <?php if ($bildiic){ $files = array(); if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (eregi("\.jpe?g$", $file) || eregi("\.gif$", $file) || eregi("\.png$", $file)) { $files[] = $file; } } } closedir($handle); } sort($files); if (!is_dir($thumb)) { mkdir($thumb, 0755); } $i = 0; $th = array(); $iw = array(); $ih = array(); $ifs = array(); foreach ($files as $image) { $thumbimage = $thumb."/".$image; $thumb_exists = file_exists($thumbimage); $size = GetImageSize($image); $width = $size[0]; $height = $size[1]; $type = $size[2]; if (!$thumb_exists) { set_time_limit(30); switch ($type) { case 1 : $im = ImageCreateFromGIF($image); break; case 2 : $im = ImageCreateFromJPEG($image); break; case 3 : $im = ImageCreateFromPNG($image); break; } $newwidth = $thumbwidth; $newheight = ($newwidth / $width) * $height; $im2 = ImageCreateTrueColor($newwidth,$newheight); ImageCopyResampled($im2,$im,0,0,0,0,$newwidth,$newheight,$width,$height); switch ($type) { case 1: ImageGIF($im2, $thumbimage); break; case 2: ImageJpeg($im2, $thumbimage, $imagequality); break; case 3: ImagePNG($im2, $thumbimage); break; imagedestroy($im); imagedestroy($im2); } } $th[$i] = $thumbimage; $iw[$i] = $width; $ih[$i] = $height; $ifs[$i] = filesize($image); $i++; } echo "<table border=\"1\" align=\"center\">"; $rows = round(count($th)/$cols); if (($rows * $cols) < (count($th))) { $rows++; } for ($i = $startrow; $i <= $startrow+$rowcount-1; $i++) { echo "<tr>"; for ($j = 1; $j <= $cols; $j++) { $td = (($i - 1) * $cols) + $j; $iu = ($td - 1); if (isset($th[$iu])) { $op = ""; $op .= "<td>\n<div align=\"center\">\n<br>\n"; $op .= "<a onClick=\"window.open('$files[$iu]','_blank','toolbar=no, location=no,directories=no,status=no,menubar=no, scrollbars=no,width=800,height=600')\">\n"; $op .= "<img src=\"$th[$iu]\" border=\"0\">\n"; $op .= "<br>$iw[$iu] x $ih[$iu]\n"; $op .= "<br>$ifs[$iu] B.</a>\n"; $op .= "<br>\n</div>\n</td>\n"; echo $op; } else { echo "<td>\n<br></td>\n"; } } echo "</tr>\n"; } echo "</table>"; }; ?> Edited January 4, 2007 by apophis Link to comment Share on other sites More sharing options...
blackhalt Posted January 4, 2007 Report Share Posted January 4, 2007 http://lv.php.net/manual/en/function.glob.php Link to comment Share on other sites More sharing options...
RaitisRR Posted January 5, 2007 Author Report Share Posted January 5, 2007 Liels paldies! ;) Link to comment Share on other sites More sharing options...
Recommended Posts