function ditchtn($arr,$thumbname)
{
foreach ($arr as $item)
{
$array = strstr($item, $thumbname);
if (!$array[1]){
$tmparr[]=$item;
}
}
return $tmparr;
}
function createthumb($name,$filename,$new_w,$new_h,$errorimage,$qual){
$system=explode(".",$name);
if (strpos(strtolower($system[(count($system)-1)]), "jpg") !== FALSE ){
$src_img=@imagecreatefromjpeg($name);
}
if (strpos(strtolower($system[(count($system)-1)]), "jpeg") !== FALSE ){
$src_img=@imagecreatefromjpeg($name);
}
if (!$src_img){
$message = ($message . "Unknown filetype!
");
exit;
} else {
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
$new_ratio = $new_w/$new_h;
$old_ratio = $old_x/$old_y;
if ($old_ratio > $new_ratio) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_w/$old_x);
}
if ($old_ratio < $new_ratio) {
$thumb_w=$old_x*($new_h/$old_y);
$thumb_h=$new_h;
}
if ($old_ratio == $new_ratio) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
if ($thumb_w == "" OR $thumb_h == ""){
$message = $message . "Unexpected error!
";
exit;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (strpos(strtolower($system[(count($system)-1)]), "jpg") !== FALSE ){
imagejpeg($dst_img,$filename,$qual);
}
if (strpos(strtolower($system[(count($system)-1)]), "jpeg") !== FALSE ){
imagejpeg($dst_img,$filename,$qual);
}
imagedestroy($dst_img);
imagedestroy($src_img);
$message = $message . "Image successfully created
";
}
}
function directory($dir,$filters)
{
$handle=opendir($dir);
$files=array();
if ($filters == ""){
while(($file = readdir($handle))!==false){
$files[] = $file;
}
}
else{
if ($filters != "") {
$filters=explode(",",$filters);
while (($file = readdir($handle))!==false){
for ($f=0;$f