In CF10 we had introduced cfoauth tag which helped in social login integration. Lets use it to build a simple facebook app which will download your facebook profile’s pic, add some image effects to it and post it to facebook.
1. First we need to ask user to login via facebook so that we can fetch his profile image.
<cfoauth type=”facebook” clientid=’YOUR_CLIENT_ID’ secretkey=”YOUR_SECRET_KEY_HERE” result=”r” scope=”” redirecturi=”REDIRECT_URL”>
2. Not lets set this info into some variable
<cfset Session.fbinfo = #r#>
3. Use cfhttp tag to download the image
<cfset thisPath=ExpandPath(“*.*”)>
<cfset thisDirectory=GetDirectoryFromPath(thisPath)>
<cfhttp method=”Get” url=”http://graph.facebook.com/#Session.fbinfo.id#/picture?type=large” path=”#thisDirectory#” file=”final.jpg”>
4. Now lets use cfimage tage to do various image manipulations
<cfimage action=’resize’ height=’#height#’ width=’#width#’ source=’#thisDirectory#/final.jpg’ destination=’#thisDirectory#/final.jpg’ overwrite=true>
<cfimage action=’rotate’ angle=’#angle#’ source=’#thisDirectory#/final.jpg’ destination=’#thisDirectory#/final.jpg’ overwrite=true>
<cfimage action=’border’ thickness=’#thick#’ color=’#color#’ source=’#thisDirectory#/final.jpg’ destination=’#thisDirectory#/final.jpg’ overwrite=true>
Once again, could really have done with being proof read, for the prose and the code.
From just the first two parts:
“CF10 we had introduced” – “CF10 we have introduced”
“” – “”
I stopped reading there because then you started using ‘ instead of ” for the tags, never mind you should use script for writing service code like this.
You must be logged in to post a comment.