" . $filename;
echo "
";
$system = explode('.', $name);
if (preg_match('/jpg|jpeg/', $system[1])) {
$src_img = imagecreatefromjpeg($name);
}
if (preg_match('/png/', $system[1])) {
$src_img = imagecreatefrompng($name);
}
if (!$src_img) {
link("icons/image.png", $filename);
return;
}
$old_w = imageSX($src_img);
$old_h = imageSY($src_img);
$new_w = $w;
$new_h = $h;
if ($old_w > $old_h)
$new_h = $old_h * ($new_w/$old_w);
if ($old_w < $old_h)
$new_w = $old_w * ($new_h/$old_h);
echo "
";
echo $old_w ."x" . $old_h;
echo " -> ";
echo $new_w ."x" . $new_h;
echo "
";
$dst_img=ImageCreateTrueColor($new_w, $new_h);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, $old_w, $old_h);
if (preg_match("/png/",$system[1])) {
imagepng($dst_img, $filename, 90);
} else {
imagejpeg($dst_img, $filename, 90);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
$refreshUri = $PHP_SELF;
if ($resizeCount == 0)
$folderIndex++;
$refreshUri .= "?folder=".$folderIndex;
if ($folderIndex > count($folders))
$refreshUri = "index.php";
?>