Best practices on handling images?

The recent tutorials on how to get authentication and authorization working in Slash GraphQL using auth0 have been fantastic! I look forward to more of these which cover the realities encountered when building an app.

Are there any best practices on how to handle images in this paradigm?
Scenario 1: Product images for a shopping app (anyone can view)
Scenario 2: Photo album app (viewing restricted)

1 Like

I think it would be better to save files in a service such as AWS S3 amd then put links into the db to reference the image.

You could store the file in binary form in a string format and then store it in the db and decode it to the correct mime type in a UI.

I read an article somewhere about storing images in a graphdb, let me try to find that.

Try looking over this:


Thanks, I agree, storing the links in dGraph and the files in S3 or similar makes sense.
For Scenario 1 where anyone can view the images, I don’t think much more is needed.

But for Scenario 2, where we need to secure the images, what are some of the things that need to be considered and is there an easy way to integrate this? (similar to how using auth0 addresses all kinds of patterns like logging in, forgotten password, etc)

(And thank you for that link. It mentions a service called Cloudinary that I will look into further.)

for scenario 2, I would investigate looking at making a function that grabs the images if approved only and then delivers them through the graphql API itself.

Although I haven’t worked on this feature yet in my project.

I have a general idea of what I’m going to do.

I will use Firebase Object store and then either:

  1. Get the link in UI & set the link along with other data to Dgraph. (Auth from front end)
  2. Or using Firebase function update link separately in Dgraph. (Auth from backend)

P.S. I don’t know if I can call external service from inside Firebase function or which approach is faster. (Maybe first is the best one!)