Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss: Handling photos #69

Open
GoGoCarl opened this issue Dec 18, 2017 · 4 comments
Open

Discuss: Handling photos #69

GoGoCarl opened this issue Dec 18, 2017 · 4 comments

Comments

@GoGoCarl
Copy link

To discuss:

I was able to get pictures to show by mapping picture: <string> to picture: { url: <string> }, then using the fieldTypes prop to tell MapFilter that pictures.url was an image. Is there an easier way to do this, or is this THE way?

@gmaclennan
Copy link
Member

It will try to guess if a property is a link to an image, but the algorithm right now depends on detecting an extension on the URL and is unreliable.

It would be possible to do requests to a URL and read the first few bytes to see if a field is an image, but that would make the field analysis async and add many network requests.

I think using the fieldTypes prop is probably the best way right now. You should not need to map anything to picture: {url: <string>} though, picture: <string> should work, if you set the fieldTypes.

@GoGoCarl
Copy link
Author

GoGoCarl commented Jan 9, 2018

K. Definitely low-priority, but would be nice. I had a different form that had the images at photo: { url: <string> }, which I re-mapped as above. Would be cool for MF2 to just find it. But like I said, I have something that works here so I'm good with mapping/fieldTypes being the way to go for now. Thanks!

@gmaclennan
Copy link
Member

Quick question, what was the URL format in the form? Maybe we can improve the URL detection algorithm?

@GoGoCarl
Copy link
Author

Standard relative URL, i.e.

/test/Submissions/jack/2016-04-06/bbc164a7-5bbd-456a-ad38-f1d80e197473_1.jpg

Only difference was that one was nested under properties.picture and one was nested under properties.photos.picture

None are absolute URLs; maybe that's what's causing the missed detection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants