header('Content-Type: text/html; charset=UTF-8');
printf("");
?>
D I N D I N X . N E T
Random Files
/**
* @return string
* @param $o_file string Filename of image to make thumbnail of
* @param $t_file string Filename to use for thumbnail
* @desc Takes an image and makes a jpeg thumbnail defaulted to 50px high
*/
function makeThumbnail($o_file, $t_file, $t_ht = 50)
{
$image_info = getImageSize ($o_file); // see EXIF for faster way
switch ($image_info['mime'])
{
case 'image/gif':
$o_im = imageCreateFromGIF ($o_file) ;
break;
case 'image/jpeg':
$o_im = imageCreateFromJPEG ($o_file) ;
break;
case 'image/png':
$o_im = imageCreateFromPNG ($o_file);
break;
}
$o_wd = imagesx ($o_im);
$o_ht = imagesy ($o_im);
// thumbnail width = target * original width / original height
$t_wd = round ($o_wd * $t_ht / $o_ht);
$t_im = imageCreateTrueColor ($t_wd, $t_ht);
imageCopyResampled ($t_im, $o_im, 0, 0, 0, 0, $t_wd, $t_ht, $o_wd, $o_ht);
switch ($image_info['mime'])
{
case 'image/gif':
imageGIF ($t_im, $t_file);
break;
case 'image/jpeg':
imageJPEG ($t_im, $t_file) ;
break;
case 'image/png':
imagePNG ($t_im, $t_file);
break;
}
imageDestroy ($o_im);
imageDestroy ($t_im);
}
$d = @opendir(".");
while (false !== ($file = @readdir ($d)))
{
if ($file[0] == ".")
continue;
if (preg_match("/index\.php/", $file))
continue;
$files[]=$file;
}
closedir ($d);
natcasesort($files); #natural case insensitive sort
$i = 0;
foreach ($files as $f)
{
if ($i % 3 == 0)
print "";
print " $f | ";
if ($i % 3 == 2)
print "
\n";
$i++;
}
?>