".."
";
//print_r($dirl);
function makethumb($imgn,$dir) {
$imgl = $dir . "/" . $imgn;
$imgs = getimagesize($imgl);
list($width, $height) = getimagesize($imgl);
$newwidthx = 100/$width;
$newheightx = 100/$height;
if ($newwidthx < $newheightx) {
$newwidthy=$width*(100/$height);
$newheighty=$height*(100/$height);
$width=$height;
$offsetx=100;
$offsety=0;
} else if ($newwidthx>$newheightx) {
$newwidthy=$width*(100/$width);
$newheighty=$height*(100/$width);
$height=$width;
$offsetx=0;
$offsety=100;
}
$newwidth=$newwidthy-100;
$newheight=$newheighty-100;
if ((stripos($imgl, ".jpg") != 0) || (stripos($imgl, ".jpeg") != 0)) {
header('Content-type: image/jpeg');
$thumb = imagecreatetruecolor(100, 100);
$source = imagecreatefromjpeg($imgl);
imagecopyresampled($thumb, $source, 0, 0, $offsetx, $offsety, 100, 100, $width, $height);
return imagejpeg($thumb);
} else if (stripos($imgl, ".gif") != 0) {
header('Content-type: image/gif');
$thumb = imagecreatetruecolor(100, 100);
$source = imagecreatefromgif($imgl);
imagecopyresampled($thumb, $source, 0, 0, $offsetx, $offsety, 100, 100, $width, $height);
return imagegif($thumb);
} else if (stripos($imgl, ".png") != 0) {
header('Content-type: image/png');
$thumb = imagecreatetruecolor(100, 100);
$source = imagecreatefrompng($imgl);
imagecopyresampled($thumb, $source, 0, 0, $offsetx, $offsety, 100, 100, $width, $height);
return imagepng($thumb);
} else {
//Print "UNKNOWN IMAGE TYPE! PLEASE CHECK IMAGE EXTENSIONS. THEY MUST BE .jpg, .gif or .png!";
}
}
if ($x != 1) { ?>