question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JPEG uri returned for PNG files

See original GitHub issue

Description

Picking a PNG image from the library returns a name of something.png but a uri of path/name.jpeg and the format of the image is actually jpeg.

I am missing some option or is this a bug?

Additional Information

  • React Native version: 0.50.4
  • Platform: iOS 11
  • Development Operating System: MacOS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:9

github_iconTop GitHub Comments

2reactions
asifvoracommented, May 2, 2018

Yes you have need to changes in ios library file(ImagePickerManager.m) image-picker package.

if (imageURL && [[imageURL absoluteString] rangeOfString:@"ext=GIF"].location != NSNotFound) {
                fileName = [tempFileName stringByAppendingString:@".gif"];
            }
            else if ([[[self.options objectForKey:@"imageFileType"] stringValue] isEqualToString:@"png"] || [[[self.options objectForKey:@"imageFileType"] stringValue] isEqualToString:@"PNG"] || [[imageURL absoluteString] rangeOfString:@"ext=PNG"].location != NSNotFound || [[imageURL absoluteString] rangeOfString:@"ext=png"].location != NSNotFound) {
                fileName = [tempFileName stringByAppendingString:@".png"];
            }
            else {
                fileName = [tempFileName stringByAppendingString:@".jpg"];
            }
0reactions
blackburniancommented, Sep 13, 2019

This is still an issue for me with v1.1.0. https://github.com/react-native-community/react-native-image-picker/pull/1099 fixes it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JPEG uri returned for PNG files · Issue #741 · react-native ...
Picking a PNG image from the library returns a name of something.png but a uri of path/name.jpeg and the format of the image...
Read more >
datauris: are PNG and JPEG MIME types interchangable in ...
A data URI can potentially contain any of 1000+ MIME types, many of which can't even be reliably detected with signature based heuristics....
Read more >
HTMLCanvasElement.toDataURL() - Web APIs | MDN
toDataURL() method returns a data URL containing a representation of the image in the format specified by the type parameter.
Read more >
Convert Data URI to PNG - Online PNG Maker
World's simplest online utility that converts a Data URL scheme to a PNG format file. Free, quick, and powerful. Import a Data URL...
Read more >
Imageio's user API — imageio 2.8.0 documentation
Note that reading from HTTP and zipfiles works for many formats including png and jpeg, but may not work for all formats (some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found