2

Is there any way to resize the profile picture you retreive from the graph api url https://graph.facebook.com/profileid/picture?type=square?

I know about the different types you can call. But I need to resize the image server side, stored in a cfimage tag, so I can display it with the correct size.

Unfortunately, I'm unable to find a way to get to the actual image, because the url doen't get resolved when putting it as source of a cfimage tag.

dreagan
  • 2,426
  • 6
  • 24
  • 34
  • If your requirement wasn't to do it on server side, I would have suggested doing it in JS with something like the aeResizeImage. – Shreeni Mar 13 '12 at 13:32

2 Answers2

4

Try something like this:

<cfhttp
    url="https://graph.facebook.com/#USER_ID#?type=square&fields=picture"
    method="get"
    getasbinary="yes"
    result="pic">

<cfset img = ImageNew(pic.FileContent)>
<cfif isImage(img)>
    <cfimage action="resize" source="#img#" width="50">
    <cfimage action="writetoBrowser" source="#img#">
<cfelse>
    <img src="Default.png"/>
</cfif>

Alternatively, you may want to save the image to disk.

Josh Siok
  • 936
  • 4
  • 8
0

Make a call to https://graph.facebook.com/USER_ID?type=square&fields=picture and parse the response. You can use that value directly then, instead of processing the redirect

Igy
  • 43,710
  • 8
  • 89
  • 115