'Multiple Image upload from smartphone ORIENTATION issue

On my website I do have a "enctype="multipart/form-data" but the problem is the pictures show up 90 degrees angle incorrect orientation.

$tmpFilePath = $_FILES["input_attachment"]['tmp_name'][$i];
$size = getimagesize($tmpFilePath);
Then I do an image resize imagecopyresampled ($img

So now I Have a resized image in string: $img Now when I do $exif = exif_read_data($img); I get an error message: exif_read_data(): supplied resource is not a valid stream resource

I don't want to do a move_uploaded_file from TMP To new file, then work on the file etc and then create a new file that seems to repetitive. I rather just work on the TMP File do what I need to do with it and THEN save it as a new filename.

Any ideas on how I can fix the exif_read_data command to read from $img ? It's a JPG file? I tried this and it does NOT work:
$exif = exif_read_data("data://image/jpeg;base64," . base64_encode($image));

Thank you so much guys.

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source