简体   繁体   中英

Upload image to Facebook from email

I have set up code that generates images from a user's stats on my website and displays it embedded in an email sent to them. I would like to add the option for people to upload this image to Facebook, but I am having issues with understanding the best way to do this (if there is one).

My code uses the PHP GD image library to pull stats, create the image, and save the file to the server. I also set up a cron job to empty the image folder daily as I intend for the images to exist only when they need to be viewed, as opening the email will create the image again.

I realize that I can send the image generated by PHP to the Facebook sharer url below.

http://facebook.com/sharer/sharer.php?u=http://example.com/image.png

The issue I am running into is that this shares the image url, rather than uploading the image itself to Facebook. As the server is wiped daily, the url does not exist consistently and would be inaccessible one day after it is shared.

I see that there are options such as using the Graph API via a url , but I'm unsure if this can be set up through email alone. My email client appears to only allow the use of HTML so I am limited in the options I can use. It also seems to require user permissions which is a lot to ask someone to upload a single image.

What is the best way to allow users to upload images from their email to Facebook for sharing purposes?

This would be the correct way to upload photos to a Profile: https://developers.facebook.com/docs/graph-api/reference/user/photos/#Creating

Of course you need to authorize the user with publish_actions for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM