Bill Clanton
Posts: 0
Joined: Wed Apr 23, 2014 2:48 pm

Photo Sharing Facebook/Twitter etc.

Hello, i have a photo sharing app, much like instagram. so far the system has been working fantastic for our vision of the app. However, the last part i need to finish is the ability for a user to share a photo on facebook. I am storing the photos in a collection called "photos" as base64 images.

How do I easily make those photos able to be shared on Facebook and or Twitter. The photos will need to be public so that non-users of the app can view them.

In addition we'd need this same method for displaying galleries on our website.

I've tried looking over the database tutorial about directly linking to files, but these photos are not in the "files" collection.

Any advice is greatly appreciated.

thank you,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Photo Sharing Facebook/Twitter etc.

Hi Bill,

You can save them to files using the function codeatob()/code:
https://developer.mozilla.org/en-US/d...

Use the following Database query:precodecurl -X POST \
-H "X-Appery-Database-Id: 516fb7c3e4b0e0d8f16ccf9a" \
-H "X-Appery-Session-Token: <session_token>" \
-H "Content-Type: <content_type>" \
--data-binary '<file_content>' \
https:&#47;&#47;api&#46;appery&#46;io/rest/1/db/files/<file_name>/code/pre

Bill Clanton
Posts: 0
Joined: Wed Apr 23, 2014 2:48 pm

Photo Sharing Facebook/Twitter etc.

should the atob() functions work by default? or is there a library i need to add?

is there an easier way to share photos on facebook? or is this the only way.

I'm guessing that i'm answering my own question, but i think in order to share to facebook i'll need a direct url to the jpg, etc. So perhaps not.

Bill Clanton
Posts: 0
Joined: Wed Apr 23, 2014 2:48 pm

Photo Sharing Facebook/Twitter etc.

just and update so far i've been able to get this to work sharing to Facebook using a bit of javascript that i found that will decode the image and then post an html5 canvas to facebook. so far it's working. next step is to find a Twitter and Pinterest solution to do the same thing.

thanks for the help.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Photo Sharing Facebook/Twitter etc.

Hello Bill,

Thank you for your update. Could you please clarify, do you need any help?

Bill Clanton
Posts: 0
Joined: Wed Apr 23, 2014 2:48 pm

Photo Sharing Facebook/Twitter etc.

you can close this ticket. i was able to use the code I had for facebook and then i whipped up a script in php to grab the base64 and save it as a jpg, and then with that i could post that to pinterest. it took quite a few steps, but in the end i have all of my sharing buttons working now.

thank you again.

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

Photo Sharing Facebook/Twitter etc.

Hi Bill, could you pls share your solution for sharing pics on FB? I am trying to use like/share button iFrame code given by FB for developers. I am not able to change that code to share a pic or custom text.

I have tried using html code given by FB for like/share button but since I am trying to setup those buttons for all of my products (fetched from a DB array dynamically), I am suggested by Appery support team to use iFrame.

If you can share your solution, I can try to relate. Thanks.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Photo Sharing Facebook/Twitter etc.

Hi Anil,

Here is our answer for this question: https://getsatisfaction.com/apperyio/...

But it would be great if Bill will help you more..

Regards.

Return to “Issues”