Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on Facebook Images & TimThumb in the Design and Development forum
Hi, Basically i'm trying to get am image using facebook graph and then crop it to 200px x 200px. Becuse i'm using wordpress i'm trying ...

  1. #1
    Master of Cheese jetdiscos's Avatar
    Join Date
    Jun 2006
    Location
    Cambridge, UK
    Posts
    73

    Question Facebook Images & TimThumb

    Hi,

    Basically i'm trying to get am image using facebook graph and then crop it to 200px x 200px. Becuse i'm using wordpress i'm trying to use TimThumb to do the resize. This seems to work for a standard image well but using the facebook image, a dynamic one, it doesn't seem to work. I think because it uses a 302 redirect.

    Is there anyway to solve this? I've tried encoding the url using php url_encode() but that didn't work.


    Thanks

    J

  2. #2
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Are you able to actually get the image into a variable (or directly into TimThumb(don't know that software)) with something like file_get_contents()?
    PHP Code:
    $tempImage file_get_contents("http://someFbAddy");
    TimThumb ($tempImage);
    //or
    Timthumb(file_get_contents("http://someFbAddy"),whatever); 
    I'm pretty sure that native PHP functions will follow redirects, so IF that's your problem you might be able to solve it in some manner such as this. If TimThumb needs a file or URL, you could write it to disk and then unlink it afterwards. Or you could cache.... whatever.

    Good luck! Sounds like a fun project.
    Good luck

  3. #3
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    PS if the problem is that fb is protecting it's images, you might need to spoof to look like a browser, which might entail cookies and the whole nine yards. If that's the case, perhaps there's something out there already written that does this.
    Good luck

  4. #4
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Skimming over TimThumb source code ( http://timthumb.googlecode.com/svn/trunk/timthumb.php ) I see that it allows images from only certain domains and certain image types and a bunch of restrictions that I couldn't follow in just a couple of minutes. Be sure you've got all the domains that facebook uses for images included in the list of allowable external sites; perhaps you should just feed the file in yourself (maybe as in the examples I gave) to simplify the scenarios for failure, at least at first.
    Good luck

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •