ls output directory images


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <div id="cycle"> <?
  2. $path = realpath(dirname(__FILE__) ."/../../../resources/images/headers"); $files = array(); if ($h1 = opendir($path)) { while (($f1 = readdir($h1)) !== false) { if ($f1 == '.' || $f1 == '..') continue; if (!is_file ($path . '/' . $f1) && !preg_match ("#\.(jpeg|jpg|gif|png|bmp)$#i", $f1)) continue;
  3. $files[] = $f1; } }
  4. sort($files);
  5. foreach($files as $file): $new_path = realpath($path . "/../../../uploaded/thumbnails"); $new_file = "800x336" . $file;
  6. $image = Phpr_Image::makeThumbnail($path . '/' . $file, $new_path .'/' . $new_file, 800, 336);?> <img src="<?= root_url('/uploaded/thumbnails/' . $new_file) ?>"width="800" height="336" /> <? endforeach ?> </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.