Created
December 14, 2015 19:25
-
-
Save mbejda/47bd4d1260869d477db6 to your computer and use it in GitHub Desktop.
Coldfusion: Publishing Photo To Facebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfset accessToken = "#Attributes.accessToken#"> | |
| <cfset sourcePath = "#Attributes.sourcePath#"> | |
| <cfset pageId = "#Attributes.pageId#"> | |
| <cfset text = "#Attributes.text#"> | |
| <cfset facebookGraphAPIPage = createObject('component','/lib/facebook-cf-sdk-master/sdk/FacebookGraphApi').init(accessToken=accessToken,appId= request.facebookAppId)> | |
| <cfimage | |
| name="temp" | |
| action="read" | |
| source="#ExpandPath( './assets/images/placeholder/#sourcePath#' )#" | |
| /> | |
| <cfset attr = StructNew()> | |
| <cfset attr.size = 40> | |
| <cfset attr.style = "bold"> | |
| <cfset ImageSetDrawingColor(temp,"Black")> | |
| <cfset ImageDrawText(temp,text,50,350,attr)> | |
| <cfset ImageDrawText(temp,text,50,475,attr)> | |
| <cfxml variable="imageXml"> | |
| <cfimage | |
| action="writetobrowser" | |
| source="#temp#" | |
| /> | |
| </cfxml> | |
| <cfset results = facebookGraphAPIPage.publishPhoto(profileId=pageId,sourcePath="http://#cgi.HTTP_HOST##imageXml.xmlRoot.xmlAttributes.src#")> | |
| <cfcontent type="application/json"> | |
| <cfoutput> | |
| #serializeJSON(results,true)# | |
| </cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment