I have a form to upload a picture file, but i want to include an option to rotate the image in the same form.
What im not sure of, is should i rotate the image before saving it, or save it, open it, rotate it, then save it again. Im not sure what is the best method for accomplishing this. The code im using is below:
$imagename = uniqid().".jpg";
if (file_exists("upload/" . $imagename))
{
//echo $_FILES["file"]["name"] . " already exists. ";
} else {
// Rotate image here before saving?
move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $imagename);
// Or open/rotate/resave image here?
}