$thumb_save_folder = $destination_folder . $thumb_prefix . $new_file_name; $image_save_folder = $destination_folder . $new_file_name; //call normal_resize_image() function to proportionally resize image if (normal_resize_image($image_res, $image_save_folder, $image_type, $max_image_size, $image_width, $image_height, $jpeg_quality)) { //call crop_image_square() function to create square thumbnails if (!crop_image_square($image_res, $thumb_save_folder, $image_type, $thumb_square_size, $image_width, $image_height, $jpeg_quality)) { die('Error Creating thumbnail'); } /* We have succesfully resized and created thumbnail image We can now output image to user's browser or store information in the database*/ echo '<div align="center">'; echo '<img src="/room_144_v1.0.4/dashboard/img/users/' . $thumb_prefix . $new_file_name . '" alt="Thumbnail">'; echo '<br />'; echo '<img src="/room_144_v1.0.4/dashboard/img/users/' . $new_file_name . '" alt="Resized Image">'; echo '</div>'; $query = $r1DataClassObject->GetChangePicture($thumb_prefix, $new_file_name, $uid); } imagedestroy($image_res); //freeup memory } } ##### This function will proportionally resize image ##### function normal_resize_image($source, $destination, $image_type, $max_size, $image_width, $image_height, $quality) { echo 'normal'; if ($image_width <= 0 || $image_height <= 0) { return false; } //return false if nothing to resize //do not resize if image is smaller than max size if ($image_width <= $max_size && $image_height <= $max_size) {