ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.14k stars 1.56k forks source link

Response file extension and mime type is different #649

Open sandropoluan opened 6 years ago

sandropoluan commented 6 years ago

Version

Tell us which versions you are using:

Platform

Tell us to which platform this issue is related

Expected behaviour

Respond file extension same with respond mime type.

Actual behaviour

Respond file extension different with respond mime type.

Steps to reproduce

This is happen when I set option compressImageQuality less than 1, and I pick PNG image from gallery. What I got is response path uri still with png extension file:///storage/emulated/0/Pictures/Screenshot_2018-03-15-16-21-12-451_com.miui.home-compressed.png

but the response mime is jpeg image/jpeg

I know that when set compressImageQuality, the image is converted to JPEG. So I think the response path uri should be .jpg as well.

My setting

        ImagePicker.openPicker({
          cropping: false,
          compressImageQuality:0.7,
          mediaType:'photo',
        }).then(image => {
          console.log(image);
        }).catch((error)=>{

        });

This problem disappear when I omit the compressImageQuality option. But I need that option still there because I need to compress the image before upload it to server

ivpusic commented 6 years ago

do you have some time to submit a pull request?

sandropoluan commented 6 years ago

I can't do Java. So I'm afraid I can't do that if that will involve some Java code.

komaldeep commented 6 years ago

I am facing the same problem

salmanxoxo commented 4 years ago

please fix this. im having the same problem.