Poszukuje jakiejś galeri tak żeby wrzucić do folderu index.php i od razu robiły ukłądało sie pololei (01,02...) i pod obrazkiem nazwa i rozmiar
np. 01.jpg
45 kb
Obrazki nie mają być miniaturami ( linkiem do dużych obrazków)
<?php $directory='pliki/'; # $kb=$kb/1024; } ?>
<?php $linia = 5; // liczba zdjec w jednym wierszu (w jednej linii obok siebie) ?>
<?php $directory='pliki/'; $linia = 5 $i = 1; { $k b= $kb / 1024; if( $i % $linia == 0 ) { } } ?>
<?php // ... ?>
<?php // ... ?> <?php $directory='pliki/'; $linia = 5; $i = 1; { $k b= $kb / 1024; if( $i % $linia == 0 ) { } } ?>
<?php { } } ?>
<?php // ... ?> <?php $directory='pliki/'; $linia = 5; $i = 1; { $k b= $kb / 1024; if( $i % $linia == 0 ) { } } ?>
<?php // ... ?> <?php $directory='gal/'; $linia = 5; $i = 1; { $kb = $kb / 1024; if( $i % $linia == 0 ) { } } ?>
<?php function imgType( $name ) { # http://forum.php.pl/index.php?showtopic=24837&view=findpost&p=162585 } function resizeImage( $source, $max_x, $max_y, $save_image, $jpeg_quality = 100 ) { # http://forum.php.pl/index.php?showtopic=24837&view=findpost&p=162585 } function showFileSize( $size ) { $pos = 0; while( $size >= 1024) { $size /= 1024; $pos++; } } $dir = './img/'; // katalog z grafikami $min = './mini/'; // katalog na miniaturki $minW = 120; // szerokość miniaturki $minH = 150; // wysokość miniaturki $perLine = 4; // ilość grafik w linii { { { { resizeImage( $dir . $file, $minW, $minH, $saveFile ); } ); } } } ?> <style type="text/css"> body, td { font: 12px Verdana; text-align: center; vertical-align: top; white-space: nowrap; } img { border: 0px; } </style> <table> <tr> <?php $num = 0; foreach( $files as $fileName => $fileInfo ) { if( ( $num % $perLine ) == 0 and ( $num > 0 ) ) { ?> </tr> <tr style="height: 5px;"> </tr> <tr> <?php } ?> <td> <i><?= $fileName; ?></i><br/> <a href="<?= $dir . $fileName; ?>"><img src="<?= $min . 'small_' . $fileName; ?>" alt=""/></a><br/> Rozmiar: <b><?= $fileInfo[ 'size' ]; ?></b><br/> </td> <?php $num++; } ?> </tr> </table>
<?php function imgType($name) { { return "IMAGETYPE_JPEG"; } { return "IMAGETYPE_GIF"; } { return "IMAGETYPE_PNG"; } } function resizeImage($source, $max_x, $max_y, $save_image, $jpeg_quality = 100) { /* * source - obrazek jpeg * max_x - maksymalna szerokosc pomniejszonego obrazka * max_y - maksymalna dlugosc pomniejszonego obrazka * save_image - nazwa pliku do ktorego zostanie zapisany nowy obrazek * jpeg_quality - jakosc powstalego obrazu jpeg - jezeli bedzie inny to argument jest nie wazny (domyslnie 100) */ if(imgType($source) == "IMAGETYPE_JPEG") { $img_src = imagecreatefromjpeg($source); } elseif(imgType($source) == "IMAGETYPE_GIF") { $img_src = imagecreatefromgif($source); } elseif(imgType($source) == "IMAGETYPE_PNG") { $img_src = imagecreatefrompng($source); } else { } $image_x = imagesx($img_src); $image_y = imagesy($img_src); if($image_x > $image_y) // Landscape { $ratio_x = ($image_x > $max_x) ? $max_x/$image_x : 1; $ratio_y = $ratio_x; $move = 'y'; } else // Portrait { $ratio_y = ($image_y > $max_y) ? $max_y/$image_y : 1; $ratio_x = $ratio_y; $move = 'x'; } $new_x = $image_x*$ratio_x; $new_y = $image_y*$ratio_y; $move_x = ($move == "x") ? ($max_x-$new_x)/2 : 0; $move_y = ($move == "y") ? ($max_y-$new_y)/2 : 0; $new_img = imagecreatetruecolor($max_x, $max_y); $background = imagecolorallocate($new_img, 255, 255, 255); imagefill($new_img, 0, 0, $background); imagecopyresampled($new_img, $img_src, $move_x, $move_y, 0, 0, $new_x, $new_y, $image_x, $image_y); if(imgType($save_image) == "IMAGETYPE_JPEG") { imagejpeg($new_img, $save_image, 100); } elseif(imgType($save_image) == "IMAGETYPE_GIF") { imagegif($new_img, $save_image); } elseif(imgType($save_image) == "IMAGETYPE_PNG") { imagepng($new_img, $save_image); } } function showFileSize( $size ) { $pos = 0; while( $size >= 1024) { $size /= 1024; $pos++; } } $dir = './img/'; // katalog z grafikami $min = './mini/'; // katalog na miniaturki $minW = 100; // szerokość miniaturki $minH = 100; // wysokość miniaturki $perLine = 4; // ilość grafik w linii { { { { resizeImage( $dir . $file, $minW, $minH, $saveFile ); } ); } } } ?> <style type="text/css"> body, td { font: 12px Verdana; text-align: center; vertical-align: top; white-space: nowrap; } img { border: 0px; } </style> <table> <tr> <?php $num = 0; foreach( $files as $fileName => $fileInfo ) { if( ( $num % $perLine ) == 0 and ( $num > 0 ) ) { ?> </tr> <tr style="height: 5px;"> </tr> <tr> <?php } ?> <td> <i><?= $fileName; ?></i><br/> <a target="_BLANK" href="<?= $dir . $fileName; ?>"><img src="<?= $min . 'small_' . $fileName; ?>" alt=""/></a><br/> Rozmiar: <b><?= $fileInfo[ 'size' ]; ?></b><br/> </td> <?php $num++; } ?> </tr> </table>