PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Ilja Müller  >  Thumbs  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: sample for the class Thumbs
Class: Thumbs
generate thumbnails of image files in a directory
Author: By
Last change:
Date: 17 years ago
Size: 918 bytes


Class file image Download

include("./class_thumbs.php") ;

// create a new Thumbs-Object(str "imagepath", str thumb_prefix, int width, int height [, int fix ])
// last (4th) parameter is optional and desides whether the size of all thumbs is
// limited/fixed by width, height or both (0 = both, 1 = width, 2 = height)
$cThumbs = new Thumbs("./pictures", "t1_", 100, 100, 2);

// get the array of all found images and thumbs
$mix = $cThumbs->getImages();
// devide the mix into images- and thumbs-arrays
list($images, $thumbs) = $mix;

// output all thumbs as links
echo "<center>Images found: ".count(@$images)."<br><br>\n";
$thumbs as $key => $thumb) {
"<a href=\"".$images[$key]."\"><img src=\"".$thumb."\"></a>\n";
//$i++; if($i % 6 == 0) echo "<br>\n";

//if($_GET['rebuild'] == 1) $cThumbs->rebuildThumbs();
//echo "<br><br><a href=\"".$PHP_SELF."?rebuild=1\">Rebuild ALL Thumbs!</a>\n";


For more information send a message to info at phpclasses dot org.