Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

unable to upload new file with rotation EXIF #148

Open theonlybenjamin opened 2 years ago

theonlybenjamin commented 2 years ago

hello, I want to upload the new file with EXIF ​​​​rotation to my server, it does not show me any error in the console, but my file is uploaded without EXIF ​​rotation. here's my code image

Donaldcwl commented 2 years ago

This lib reads the EXIF rotation information and rotates it accordingly. It is normal that the output file does not have EXIF information.

theonlybenjamin commented 2 years ago

Yes, want i want to do is upload the rotated file, and dont need the exif information on the file, i just need the rotated file but it(the lib) doesnt rotate the file. The exif rotation number is 6 but my image arrives like this to the server(original image, withouth rotation) image

theonlybenjamin commented 2 years ago

maybe im doing something wrong, please I would really appreciate your help

Donaldcwl commented 2 years ago

@theonlybenjamin It seems that your image file is png, you may provide the exifOrientation value in the option. For example:

options = {
  maxSizeMB: 1,
  useWebWorker: true,
  exifOrientation: 6
}

We only detect EXIF rotation information for jpg images at the moment.

theonlybenjamin commented 2 years ago

its jpg image, give you some pictures: this is the file: image uploading the file: image and this is the code: image Even if i harcoded the exifOrientation property with 6, it doesnt rotate it

Donaldcwl commented 2 years ago

Can you zip the jpg file and upload it here?

its jpg image, give you some pictures: this is the file: image uploading the file: image and this is the code: image Even if i harcoded the exifOrientation property with 6, it doesnt rotate it

theonlybenjamin commented 2 years ago

of course, there you go test.zip

Donaldcwl commented 2 years ago

image test_result.zip @theonlybenjamin I cannot reproduce your issue, the lib detects it's exifOrientation value is 6 and rotated it accordingly. You may try it out in https://donaldcwl.github.io/browser-image-compression/example/basic.html I have upload my test_result.zip here for your reference.