How can i share images from S3 without sending the link?

#1

I want to share content from my app. I am using the share module from react native. It is buggy as it does not send the title.

I have images saved in S3 and I was wondering if there was a way to share these images without sharing their link back to S3

#2

I got what you need right here!

Basically:

  • Get a remote url from s3
  • Download it and cache with FileSystem
  • Get the local cached URI
  • Share that sucka (non-s3 URI)
    :grin:
2 Likes
#3

Thank you very much, may I ask another question? do you know how to get it to hide the link you sent with it if you want to deep-link back to the app. expo usually sends the scheme as a link to click but I want to emulate this:

#4

Gotcha… Let’s break it down

  1. Not your question: To emulate this view in react native I would use something like this + gifted chat
  2. When you send a link, iMessage uses a custom service to get that image from the supplied uri (something like point 1)
  3. When you send someone a random url from React Native like this one, iMessage will pull a picture from the uri and show it :smiley: Basically the same as points 1, and 2
  4. If you send just a link to an image, the url will hide automatically. (like the example snack should)
  5. Lastly you cannot sneak a url redirect into an image (OS thing) :stuck_out_tongue_closed_eyes: I’ve tried
#5

ohh, thankyou. this is really helpful.

I think i require 1+2. I have an app for posting blog posts, so that your friends can read them. I wanted to add the ability for them to share those posts outside the app, so the image of the posts would show with a text and link back to the app

#6

I would recommend putting the image localUri as the uri and then put the link to your app in the message, iMessage will automatically convert it into a link :blue_heart::blue_heart:

1 Like
#7

thank you very much. do you know why the ‘title’ field doesn’t send anything?

#8

Hi,
can i use uriAsync for save pdf file too and then share it?
Thanks

#9

TL;DR: Yes, but I need to exceed 20 characters to make a post :stuck_out_tongue_closed_eyes:

yes, only difference is that when using it with images it gets the {width, height} but that isn’t required for .pdf so it doesn’t matter :sweat_smile:

1 Like
closed #10

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.