//Create Thumbnail------------------------------------
$my_input_file = "../../../photos/index/$image";
$my_output_file = "../../../photos/index/$image";
// set output jpeg qualit
$jpeg_quality = 80;
// set thumbnail height to use
$thumb_width = 330;
$size = getimagesize($my_input_file);
// $size[0] = the width of input image : $size[1] = the height of input image
// calculate thumbnail width based on ratio of width / height of input image
$thumb_height = ($size[1] / $size[0]) * $thumb_width;
// create image in memory
$src_img = imagecreatefromjpeg($my_input_file);
$dst_img = imagecreatetruecolor($thumb_width,$thumb_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_height, $thumb_width, $size[1], $size[0]);
// write output image
imagejpeg($dst_img, $my_output_file, $jpeg_quality);
// imagejpeg($dst_img, null, $jpeg_quality);
// free memory used
imagedestroy($src_img);
magedestroy($dst_img);
printf("Photo Resized...");
printf("<br>Photo entered into database...");
printf("<br>Done!");
//----------------------------------------------------