What Is Facebook Photo Fetcher?


Facebook Photo Fetcher is a Wordpress plugin that allows you to quickly and easily generate Wordpress photo galleries from any Facebook album you can access.

The idea was inspired by Fotobook, though its approach is fundamentally different: while Fotobook's emphasis is on automation, this plugin allows a great deal more customization. With it you can create galleries in any Post or Page you like, right alongside your regular content. You do this simply by putting a "magic HTML tag" in the post's content - much like Wordpress Shortcode. Upon saving, the tag will automatically be populated with the Facebook album content. Presentation is fully customizable via parameters to the "magic tag" - you can choose to show only a subset of an album's photos, change the number of photos per column, show photo captions, and more.

Also, Facebook Photo Fetcher does not limit you to just your own Facebook albums: you can create galleries from any album you can access, including groups and fanpages. This is very handy if you're not the main photo-poster in your social circle: just let your friend or family upload all those wedding pics, then import them directly to your blog!

Features:
  • Uses Facebook's API to instantly create Wordpress photo galleries from Facebook albums.
  • Galleries are fully customizable: you can import complete albums, select excerpts, random excerpts, album descriptions, photo captions, and more.
  • Galleries can be organized however you like: in any post or page, alone or alongside your other content.
  • Simple PHP template function allows programmers to manually embed albums in any template or widget.
  • Galleries can be created from any album you can access: yours, friends', groups', or fanpages'.
  • Built-in support for automatically attaching Post Thumbnails to any post or page that includes a gallery.
  • Built-in lightbox: Photos appear in attractive pop-up overlays without the need for any other plugins.
  • Admin panel handles all setup for you: Just click Connect, login, and you're ready to start making albums.
  • Admin panel includes utility to search for all albums you can access (and use to create galleries).
  • Admin panel includes utility to auto-traverse your galleries, updating those that've changed on Facebook.
  • No custom database modifications: all it does is automate the creation of post/page content for you.
To get started, check out the Instructions section below.


Demo


The following box contains a sample gallery imported from Facebook using this plugin. It's generated by one single "HTML magic tag" placed in the content of this page:

From Petrified Petra, posted by PederY on 6/13/2009 (Showing 16 of 60 items)

"Justin and I returned to the hotel after our late night at Petra. We decided to start bright and early the next day and get moving before the sun came up. Ladden with water, cameras and kebabs we ventured into one of the most amazing ancient structures on earth. And it would truly be a day to remember."

Generated by Facebook Photo Fetcher


Instructions


  1. Download the latest version from here, unzip it, and upload the extracted files to your plugins directory.
  2. Activate the plugin via your Wordpress admin panel.
  3. Head over to Settings -> FB Photo Fetcher.
  4. Click the "Login to Facebook" button to popup a Facebook login page. Enter your information, click "Login", then close the popup. Next, click "Grant Photo Permissions." Accept the permissions in the popup and when it says "Success," close it. Finally, click "Save Facebook Session." It should now say This plugin is successfully connected with xxxxxxx's Facebook account.
  5. Now we need to get the ID of an album you'd like to import. Click the "Search for Albums" button; It will automatically connect to Facebook and produce a list of all the albums you can access, each with an associated ID number. Let's use the example 1234567890123456789.
  6. Create a new post or page and enter the following tags, replacing the example ID with the one you'd like import. Note that you must use the HTML Editor (not Visual Editor) for the tags to be recognized:
    <!--FBGallery 1234567890123456789 --><!--/FBGallery-->
  7. Click "Save", and you're done! You can now view your new album.
Ways to customize the album's behavior (including Group and Fanpage support) are listed in the next section.


Customizing


Magic Tag Parameters


Let's start off with the basic code for importing a Facebook album into a page or post:
<!--FBGallery 1234567890123456789 --><!--/FBGallery-->

If you want a bit more control over how this presents the album, there are a number of parameters you can add to the opening tag, after the album ID number. These are:
  • cols=#: Set the number of photos to show per row (default is 4).
  • start=#: Start showing photos from the given index (i.e. to skip the first 2 photos, enter start=3)
  • max=#: Limit the number of photos (i.e. to only show the first 5 photos in an album, enter max=5)
  • rand=#: Show a random selection of photos from the album. This is applied after start & max, so to show 5 random photos from the entire album, enter rand=5; to randomize the first 5 items in the album, enter start=0 max=5 rand=5 (first limit the photos to the first 5, then randomize them).
  • orderby=reverse: Flip the order of photos in the album (i.e. to show only the latest, you'd use "orderby=reverse max=1")
  • hideHead=1: By default, albums will display their author, item count, and description prior to the first photo. Setting this will omit it that information.
  • swapHead=1: Swap the order of the information in the header - author first, description second.
  • hideCaps=1: By default, each photo shows an excerpt of its caption below it. Set this to omit them.
  • noLB=1: By default, this plugin outputs the JS needed to setup the lightbox popups. Set this to omit it.
As an example, the demo gallery above was created with the following tag:
<!--FBGallery 1234567890123456789 cols=4 max=16 swapHead=1 --><!--/FBGallery-->

Groups & Fanpages


Thus far, we've only discussed importing personal photo albums. Here's how you'd create a gallery from a fanpage or group:
  • To show photos from a specific album within a fanpage, simply input its albumID in the magic tag. Mouseover here for how to find the albumID of a fanpage album.
  • To show all photos from a fanpage, add the parameter isPage=1 and replace the albumID with a pageID.
  • To show photos from a group, add the parameter isGroup=1 and replace the albumID with a groupID.
For example, if you wanted to create a gallery from the Wall Photos album of my fanpage, you'd use:
<!--FBGallery 215851691826634_50508 --><!--/FBGallery-->

If you wanted to create a gallery that randomly selects 10 photos from all albums on my fanpage, you'd use:
<!--FBGallery 215851691826634 isPage=1 rand=10 --><!--/FBGallery-->

Note: See FAQ #18 if you're experiencing issues with Group albums.

Albums from PHP


If you've got a custom template or widget in which you'd like to include a gallery, you can call the function fpf_fetch_album_content() directly. It accepts the same parameters as the HTML tags above; for example:
$album = fpf_fetch_album_content( '123456789', array('cols'=>6, 'max'=>18) );
echo $album['content'];
echo "Thumbnail: " . $album['thumb'] . ", Photo Count: " . $album['count'];

Post Thumbnails


This plugin supports automatic Wordpress Post Thumbnails. If you download and install the Add From Server plugin and set a thumbnail path in this plugin's Settings page, it will copy each album's thumbnail to your local server and attach it whenever you create or update a gallery.

Item Counts


Whenever a Facebook album is inserted into a post, that post will be given the postmeta "_fb_album_size", containing the number of shown items in the album. You can reference this from your code if you wish.



Although this plugin is free to use and enjoy, it did not write itself. If you find it useful, a glass, pitcher, or keg of beer for the author would be greatly appreciated. I promise to enjoy every ounce of it :)

FAQ

Note: Numbers may not be sequential as I remove old or outdated FAQs.

1. Magic Tag? Why not just call it shortcode!
I call it a "magic tag" because the way it works isn't quite the same as shortcode: Shortcode generates the content on-demand; that is, whenever a user loads a page, the shortcode will be processed and produce some html for them to view. The "magic tags" are processed when you save the page, downloading the album and inserting it as regular HTML. This avoids the need to connect to Facebook every time someone views a gallery, and also lets existing galleries continue to work even if the plugin is disabled.

2. You mentioned that it includes its own Lightbox support; will this conflict with the Lightbox2 plugin?
Nope - it checks for the presense of that plugin, and omits its own Lightbox code if present. And of course you can always disable lightboxing manually by specifying the noLB parameter to tags.

3. When trying to connect to Facebook, I get the error message "Failed to get a session secret."
Make sure you've logged in to the popup Facebook window before closing it and clicking "Save Facebook Session." The popup login window should say You may now close this window and return to the application before you close it. If it doesn't, you haven't logged in.

5. When I save my gallery pages it just says "Invalid Album ID."
Make sure there's a space after the albumID in the start tag - this wasn't a requirement in earlier versions, before I learned that ID's can contain dashes and underscores as well as numerals.
(i.e. <!--FBGallery 123456 -->, not <!--FBGallery 123456-->)

8. Albums are getting imported, but they always show as one huge column of photos.
This is a CSS issue. Most likely your theme isn't calling wp_head() in its header.php template, so Wordpress has no way to output the default stylesheet I've included.

9. I've got an idea for another feature. Could you implement it?
The main reason I wrote this plugin was for personal use. After I'd finished getting it all up and running, I later decided, "Since I've already put the effort into making it I may as well let others benefit from my work as well." So I put a nontrivial amount of extra time into creating an easy-to-use admin panel, implementing all kinds of safety checks, adding nicer presentation code, documenting it, and so forth. While I'm ecstatic to see so many people making use of it, unfortunately I can't offer more of my time for free (aside from smaller bug fixes). If you'd like to hire me to add a feature or tailor it to your needs I'd be happy to discuss it, and I'm always interested to hear your ideas. For reference, I'll keep a list of some of the cooler suggestions here:
  1. Generalize the code so it can be used on any PHP site, outside of Wordpress.
  2. Add the option to download all photos and attach them to the parent post, so they can be viewed and commented on individually (and listed by standard Shortcode).
  3. Get photos for Events
  4. Show the names of tagged users in photo pop-ups
  5. Show Facebook comments in photo pop-ups
  6. Search for albums and auto-insert the Magic Tags directly from the "New Post/Page" screen
  7. Schedule cron jobs to automatically re-fetch all albums
  8. Pagination of albums
  9. Localization
  10. Generate an "index page" for imported albums
  11. Allow more than one "magic tag" per post/page
10. Some of my photos appear as tiny squares / Popup lightboxes just show the loading animation forever
Although this plugin generates the content needed to *show* your Facebook albums, the photos themselves still reside on Facebook's servers - which can be pretty unreliable at times. If some of your images won't come up, login to Facebook directly and see if those same images are working. My bet is they're not.

11. When I save a post with Magic Tags, nothing happens - the tags remain but it doesn't fetch the album.
See FAQ5. Also, make sure you're using the HTML Editor, not the Visual Editor.

12. The lightboxes aren't working - when I click an image, it just shows up in its own window.
You probably have Javascript errors on your site which are causing the browser's JS engine to abort before reaching the Lightbox code. Try debugging your site with Firebug to make sure you've fixed all other JS errors.

15. When I click a photo, it pops up partially obscured behind some other element on my page.
This is an issue with your theme's CSS. You'll need to edit your stylesheets and fix the z-indices so the lightboxed image comes up on top.

16. Is it possible to make a randomized album re-randomize its photos on every pageload?
If you create an album by calling the PHP functions directly (in a custom template), photos will be fetched and randomized each time the page is loaded. To achieve this behavior with magic tags (i.e. in your posts), you'll need to write your own filter to do so (try calling fpf_run_main() from a filter on "the_content"). However, as this will be very resource-intensive and will make your pageloads dependent on Facebook itself, I don't recommend it - a better idea would be to setup a cron job to re-fetch the album periodically (i.e. once an hour). This maybe added to a future version, but for now I'm afraid you're on your own.

17. When I activate the plugin, I get an error like "Parse error: syntax error, unexpected..."
This plugin requires PHP5; you're probably still using PHP4.

18. Group albums aren't working - they always show 0 items, even for groups that are completely open.
It would appear that Facebook's old REST API doesn't support their new group format, so while old groups will continue to work, you may experience problems with new ones. The only fix I've been able to find would be a complete API upgrade, a nontrivial task which I unfortunately cannot do at this time. If anyone with Facebook API knowledge manages to find a workaround I'd be more than happy to implement it, otherwise I'm afraid it'll have to remain as-is until there's a lull in paid jobs that make time for the upgrade :)

19. I'm getting "Fatal error: Uncaught exception ‘FacebookRestClientException’."
Try re-authorizing with Facebook by clicking "Change Facebook Account" in the admin panel. If that doesn't fix it, it's possible that one of Facebook's servers is having an issue - please wait a few hours and give it another try.

20. Is there a way to create an "index page" that links to all my imported Facebook albums?
Sure, but it requires custom coding. You can implement this by creating a page template that iterates through and lists its child pages, then make your albums children of that page. For help, please see the WP docs.

21. The plugin only seems to work with albums that have less than X-number of photos.
Most likely your webhost has set too low of a "max_execution_time" in php.ini, or the server is too overloaded and is timing out. You can determine this by checking your logs (or contacting your host if you don't know how).

22. When I update an album on Facebook, it isn't reflected on my blog.
See FAQ1 for how this plugin works, and why it doesn't reconnect to Facebook on every pageload. To bring your galleries in sync with Facebook you may re-save them manually, or use the "Re-Fetch" buttons in the admin panel. If you want to make it automatically re-fetch, you'll need to implement a cron job (FAQ9, 7th subitem). Also see FAQ16.

23. When I updated this plugin to v1.3.0, all the lightboxes stopped working.
As per the release notes, 1.3.0 includes a different lightbox implementation (which is GPL-Compatible). To restore functionality to your albums, you'll need to re-fetch them just once - which you can do via the "Re-Fetch All Albums In Pages" and "Re-Fetch All Albums In Posts" admin panel buttons.

100. Something else isn't working as you've described!
Improperly coded themes and conflicting plugins are two of the most common sources of error, so if you're confident you've followed the directions above and something still isn't working, please try it again with all other plugins disabled and with the default Wordpress theme. If that works, you should be able to pinpoint the source of the issue by reactivating them one at a time.

101. How can I get personalized help with this plugin?
As described in the following section, I'm unfortunately no longer able to offer free one-on-one support for this free plugin. If I'm directing you to this FAQ, it probably means that you e-mailed me directly or posted a personal question below, disregarding the information under "Feedback/Support." Please read that section for a full explanation of my current support policy.

Feedback/Support


So, you've setup the plugin and it isn't doing what you expect. What now? The first thing you should do is carefully reread all the documentation above, paying special attention to the FAQs; 99% of support questions are solved by the solutions already offered above.

Still no joy? If you need personal help, you can get paid support by donating at least $20USD to the author:


You may then email me your question and I'll get back to you as soon as I can. It will improve the process if your message contains the following information:
  1. A clear explanation of the problem: When does it happen? When doesn't it happen? What do you see?
  2. What have you tried? Did try it with the default theme and all other plugins disabled?
  3. Provide a link to the gallery that isn't working, if available.
  4. Provide the exact tags you're using, if available.
If you'd like to get in touch for a non support-related reason (i.e. feedback, job requests, feature suggestions, unrelated rants), you may use the comment thread below, but please remember that I will no longer be replying to requests for free support. I'm sorry to do this (I avoided it for well over a year), but due to the overwhelming stream of questions (even after the plugin was deemed stable by many thousands of users), I can simply no longer afford to offer my time for free.


Advertise | Disclaimer
©2004-2012 Justin Klein
XHTML Valid
20:56:08 2.0s 127q 47.5m