if(!$_FILES['photo1']['tmp_name']=='') {
// Check image size
$img = $_FILES['photo1']['tmp_name'];
$size = getimagesize($img);
$width = $size['0'];
$height = $size['1'];
$ratio = $width / $height;
$resolution = $width * $height;
$size = filesize($img);
$size2 = $size/1024;
$size3 = round($size2/1000, 3);
$min_width = "2000";
$min_size = "1500";
if($width > $min_width && $size2 > $min_size) {
// Filename => XXXXX_antica1.jpg
$photo1 = $name . '_antica1.jpg';
$photo1 = str_replace(' ', '', $photo1);
// Destination => fileupload/XXXX_antica1.jpg
$destination1 = "../../antica2006/" . str_replace(' ', '', $photo1);
$result = move_uploaded_file($_FILES['photo1']['tmp_name'], $destination1);
$thumb_width = '200';
$thumb_height = $thumb_width / $ratio;
$thumbnail1 = $name . '_antica1.jpg';
$thumbnail1 = str_replace(' ', '', $thumbnail1);
$dest = "../../antica2006_thumbs/" . str_replace(' ', '', $thumbnail1);
$thumb1 = ImageCreateFromJPEG($destination1);
$thumb2 = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($thumb2, $thumb1, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height);
ImageJpeg($thumb2, $dest);
chmod("$dest", 0777);
}
else {
$photo_num = 1;
if($width < $min_width) {
$error_width = '1';
}
if($size2 < $min_size) {
$error_size = '1';
}
include('photo_error.php');
exit;
}
}