Coder Social home page Coder Social logo

Comments (6)

olofd avatar olofd commented on August 16, 2024 1

Sounds good. I will definitely look into implementing RCTURLRequestHandler. Did not know it existed before this and I sounds like a feature we should support. Let me know if there is anything else I can help with.

from react-native-photos-framework.

adbl avatar adbl commented on August 16, 2024 1

Nice to hear! Feel free to reference this issue when that's merged in case someone searching for this kind of stuff to help put the pieces together

from react-native-photos-framework.

olofd avatar olofd commented on August 16, 2024

Hi!
Would be glad to help, but let me ask you:

How are you sending the image? Some custom ObjC-code I would guess?
If that's correct I guess you are loading the image with the imageloader defined in this library or by using the React Natives imageLoader that you can use via the bridge in native modules?

If that's the case this is only an extension in our imageLoader?

We could make the extension of course, but it would seem easier, I you already have custom ObjC-code to just load the desired image yourself using PhotoFramework, in the format you like and then send the bytes.

Enlighten me if you are using some RN-feature to send the actual image. Like if RN's XHR has the ability to post images loaded with RN.. Is that the case?

Sry if I'm confused. Would like to help, just need some more info.

from react-native-photos-framework.

adbl avatar adbl commented on August 16, 2024

I realized that my request doesn't make sense anymore, but I'll answer your questions anyway because I learned I few things which may be useful.

A) RN XHR can send binary "file" data from things that implement RCTURLRequestHandler interface. In fact, the RCTImageLoader implements it too (it seems) checking all available image loaders, (but it needs a recompress which is not ideal). If this library implemented the RCTURLRequestHandler directly, sending the "raw" file with XHR would be supported out of the box.

B) In our case we first use the RN ImageEditor to allow the user to crop the image (but at a fixed pretty high resolution...), ImageEditor uses the ImageLoader method which doesn't specify size, so max resolution will be used. It then places the cropped Image in ImageStore which implement both ImageLoader and RCTURLRequestHandler. We could send it with XHR directly using the ImageStore uri, but we also need to store the file locally so we have a piece of native code which writes the data to a file before sending it (using react-native-fetch-blob due to other reasons).

C) when we really need to load the full resolution image in a view (for example to do interactive crop/zoom preview), we should just set the style width/height as specified by the asset and it will get loaded (then put in a ScrollView or something).

I elaborated on some of this here wkh237/react-native-fetch-blob#218

from react-native-photos-framework.

olofd avatar olofd commented on August 16, 2024

@adbl Should we close this?

FYI: I'm implementing RCTURLRequestHandler at the moment. It will land next week. (I know you found another solution, but I still thought it made sense to implement the interface).

from react-native-photos-framework.

olofd avatar olofd commented on August 16, 2024

RCTURLRequestHandler implementation is now released under 1.0 on npm.

from react-native-photos-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.