Hi...
I'm not sure if this is the right forum for this but...
Has anyone looked into creating a facebook application now that facebook has opened up its API for developers? I was thinking that it'd be great to have an app that would selectively import albums from my Gallery install into my facebook profile.
I have a ton of images in my Gallery and never bother to import them to facebook as it's too much extra work. However, many of my friends don't see them as they don't venture out of facebook to look at the pictures (that's the point of social networking sites, right?) so the images aren't viewed by just having them in my Gallery. There is already a facebook app for iPhoto that does exactly this.
Does something like this sound interesting to others? Any thoughts or ideas?
Posts: 9
I was actually just going to make the same suggestion and you beat me by 20 minutes. It would be an AMAZING add-on to facebook because I, too, have a ton of photos that I would never bother importing to facebook because it would take way too long.
Sadly, I have no idea how to go about writing such code, but the developer tools are here:
http://developers.facebook.com/
Posts: 59
Superb idea - I was just talking to a friend recently and we thougth it would be great to integrate Gallery into Facebook. The only thing, is I've no idea how to go about it!
---
Robert Hollingworth
www.roberthollingworth.co.uk
www.theballphotographers.com
Posts: 16
I think I might try my hand at it - I have no idea what I'm doing so don't expect magic but if anyone wants to give advice or comments I would certainly welcome them.
I think it would be easiest to create a module for Gallery that would export to facebook...thoughts?
Posts: 9
I really have no idea if it's possible, but what about somehow linking an existing gallery to a facebook, whereby a facebook user could select albums to appear in facebook. The linked albums would look and operate just like ordinary facebook albums.
This could be really useful if picture tagging is ever implemented in gallery.
Posts: 9
Also -- this could ensure that updates to an album would be picked up by facebook without making all the changes yourself.
Posts: 16
Any developers want to volunteer to help out with this? I think I'm in over my head.
Posts: 5
Yup I may give it a shot over the weekend. I don't promise anything though
Posts: 16
Awesome! Let me know how it goes.
Posts: 9
I looked at the developer stuff and it seems like it would be really easy to get something basic out the door pretty fast. The fact that it's mainly PHP-based would make it super easy.
Something basic would create a section (or "window"?) on our facebook profile that would show a listing of all the albums in a Gallery "root." The listing would display the highlight picture for each album and simply link to the albums on our external sites.
Later on we could look at adding deeper integration, but this would be a great starting point.
I would love to try and do it myself, but I'm in the process of moving, and I'm going out of the country for a month next Saturday.
Posts: 16
I don't know if this is better or worse but the way I was thinking of implementing it was a module that plugged into gallery allowing the user to choose from a list of albums (or items) from a control panel page that he wanted to transfer to facebook. The album would then be created on facebook and then each of the child images in the album would be uploaded to fill the facebook album.
This approach would allow it to tie directly into facebook with all of the familiar notifications and news feed items (UserX has added a new gallery, etc). To a facebook user it would appear as if the gallery had been uploaded normally. A Gallery user could have his galleries in two places with just one upload action on the user's part. If you changed the Gallery album later these changes wouldn't be propagated across to facebook, however (or vice versa).
Alternatively, instead of a module page you could have a link on each album in the album actions that would allow the user to select that gallery for transfer to facebook and just store the users facebook credentials from the module setup page.
Posts: 9
Shorty --
All of the data (images and databases) need to be stored externally from facebook, so doing an import would really just be making another copy on our own servers to get them on facebook. Ergo, why not just have them linked from where they are?
In the long term, I definitely agree that any application should act and feel like the normal facebook photo albums, but I'd just like to get my pictures on my profile and then worry about that deeper integration later.
Posts: 9
I DID IT!!!
Granted, this is totally an alpha version, I got my albums listed on my facebook profile:
[img]http://www.newstohughes.com/images/gallery_for_facebook.jpg[/img]
The plugin is useless to anybody besides me because it doesn't allow you to pop in the information for your server, etc. But -- making the little script that I've written more customizable would be an awesome first step to getting the ball rolling here. Start with just listing the "root" albums automatically, then move into customizing which albums will be shown, and finally make it look and work just like facebook's photos albums.
Like I said, I'm moving and going on vacation for a month, so I won't be able to do anything else here, but if someone else wants to take this little script I started and run with it, please do. Details below...
Best,
Ryan
----------------
I followed the step-by-step instructions here:
http://developers.facebook.com/step_by_step.php
When I was done, I came out with these files:
index.php:
appinclude.php:
dbappinclude.php:
Posts: 16
That's a good start! I guess I wasn't thinking of actually creating a facebook "application" that would actually connect to the database and pops into the profile page but rather just using the Facebook API to actually upload photos to facebook from Gallery. http://developers.facebook.com/documentation.php?v=1.0&doc=photoupload
I'm interested to know what others think.
Posts: 9
I didn't realize that functionality was available. Maybe a final version could include the capability to embed photos directly from Gallery the way I did and to import the way you are describing.
For me, displaying my photos directly from Gallery is a much more appealing option. That way, I don't have to upload them to Gallery and then do a Facebook import. Likewise, I wouldn't want to delete from Gallery and then from Facebook. Changes would show up automatically. Plus, Facebook lowers the quality of images significantly. I would much rather my high-quality images be shown.
But on the flip side, I can see why you would want to do the import with all of Facebook's tagging capabilities, etc.
Posts: 16
Exactly. Neither way is perfect and both have their uses. For me, I may only be able to do it with a direct upload because I believe my MySQL host (1&1) requires that the database be queried from within their firewall, i.e. no external queries.
Posts: 9
Facebook applications reside on external servers. Facebook calls my PHP from their servers, and it runs on mine, executing all SQL queries locally. The results are piped through the locally run PHP script back to Facebook.
Posts: 1
Well, I think, It would be good if the Photos can be displayed randomly...
Currently, I am trying to make the make the API to list photos on an Album... But when you click the Thumb Nail, It will take the user to the Gallery URL... I think its hard / nearly Impossible to create an API to behave EXACTLY like the Facebook Album.
If I managed to do it, I will let you know.
Posts: 40
I created a simple FB Application that takes a Gallery URL, makes you pick one of the albums found at that URL, makes you choose which pictures from that album you want to upload, and then uploads all those photos into a new FB album that has the same name as the Gallery album.
If an album with the same name already exists, photos will be uploaded in it. It won't re-upload photos that it already uploaded before in this album.
You can try it here: http://www.facebook.com/apps/application.php?id=2390304162
Once added, you'll get a small block in your FB Profile page with a link:
"Gallery Import: You can start importing Gallery albums [here]."
There's probably a lot of quirks in it; it uses data-scrapping, so it might not work right with Gallery installations not using mod_rewrite, etc.
Feedback is welcome.
- Guillaume Boudreau
Posts: 16
This is exactly what I was looking for. Unfortunately, I can't get it to work. I put in the URL of the gallery (I've tried top level,, gallery with subalbums, and the lowest level URL) but it's unable to pull up a list of albums. I do use URL rewrite to format the URL to domain.com/gallery/CategoryAlbum/FinalAlbum/IMG_9999.JPG.html. Any ideas?
Posts: 40
I'd have to see the HTML source of your Gallery homepage to see what is different from mine.
I guess I data-scraped a part of the page that is only part of the theme I use...
(The URL you enter *must* be the homepage of your Gallery installation: http://domain.com/gallery for example).
Now that I think about it, we need a better way to get Gallery data than data-scraping. Anyone know an easy way to get a list of albums, or items in an album, in any text-only format (XML or text or JSON or ...)
For now, I think I'll just create a small PHP page that will query my Gallery database directly.
- Guillaume
Posts: 16
Also, possibly a "select all" "select none" button on the thumbnails page would be great. Ok, done for real.
Posts: 40
There. I added a helper script to install in your Gallery host that helps provide albums and photos information. I uses Gallery internal functions, so I didn't code any MySQL access or whatnot; nothing to configure in the helper script either.
Follow instructions found in the Step 1 (click the export_fb.php link) to install this helper script.
Still to fix:
When importing many pictures, the import step will often give an error. If this happens, first approve all the photos that the application was able to upload in FB, then hit Refresh in the Gallery Import application. The next photos will be uploaded.
Enjoy.
- Guillaume
Posts: 5
How about using the Gallery Remote interfaces?
Posts: 40
Can the Gallery Remote interfaces give information about photos items contained in Albums?
I never saw any photo information in Gallery Remote, only albums.
- Guillaume
Posts: 16
Ok, I made it a bit farther this time. I got the script uploaded to my server. In facebook I got the list of albums, selected one, viewed the list of images, and clicked continue. The album was created but no photos were imported. I tried this on several albums with the same results.
Thanks for your work on this, Guillaume, this will be great once the bugs are worked out.
-Ryan
Posts: 16
After taking a look at the output from the php script I see that it was looking for the "download" rewrite. I didn't have it activated but after doing so it was able to find the images and import them. I had some difficulty with the script apparently timing out. After refreshing the page a couple times most of them did import successfully. I say "most" because it cut my album off at 60 images. Would it be possible to automatically create a second album with the same name + "2" after it to upload the rest (or 3 or 4, etc).
This is great. Thanks again.
-Ryan
Posts: 16
I'm noticing that it requires me to refresh the page while importing for every 20 images. If it's less than 20 no refresh is needed. (Last post of the night, I promise)
Posts: 40
Done. New albums are created as needed now.
I asked about this in the FB discussion forum, and I'll update the app once I get a viable solution.
Until then, I'll show a 'click [here] to continue importing' every 15 photos, so it won't show errors.
FB doesn't allow onclick JS on links, so I have to reload the whole page to select or deselect all photos. Not that cool, but it works.
I also changed the export_fb.php script to not use rewrite URLs anymore, so if you update it, you won't need the rewrite module anymore.
- Guillaume Boudreau
Posts: 16
I just imported an album with 150 images. Besides having to click continue (which is, though, a much better option than hitting refresh after seeing a "cannot connect" page) the process was great. The successive albums were created nicely and I didn't see any error messages.
Cool.
Posts: 18
Does this Facebook app export the images with the watermark? Because I have noticed that some Gallery modules seem to ignore images with watermarks and just use the original image instead.
Posts: 40
It exports the image that is shown at this URL:
http://your_gallery_url/main.php?g2_view=core.DownloadItem&g2_itemId=$photo->id&g2_serialNumber=1
where $photo->id is the ID of the photo item.
The watermark module seems to allow you to add watermarks to image when they are linked to on external websites.
This FB app doesn't link to images: it uploads them on FB.
If you can give me a generic URL to download a watermarked image, I could add an option in export_fb.php to use that URL or not.
- Guillaume Boudreau
Posts: 18
please delete/ignore
Posts: 40
Adding the application adds a block in the right column in your profile page.
- Guillaume Boudreau
Posts: 40
About watermarked images:
I changed the export_fb.php script to use the watermarked image, if there is one.
Just update it on your server and you should get watermarked images when importing into FB.
- Guillaume Boudreau
Posts: 18
Cheers for getting back so quickly, works like a treat! Thanks
Posts: 40
I modified the application to import all photos without user intervention; no need to click Continue each 15 photos now.
- Guillaume Boudreau
Posts: 16
Awesome, Gillaume, it worked like a charm!
Posts: 18
Problem:
When importing, if I "select none" or "select all"
Im getting a 404 file not found error..
Also, all the pictures arent showing up.
eg: select album w 9 photos.
Page for photo selection shows just 1 photo (but says it found 9)
What permissions does this use for the import? (guest i hope!)
NB:
im not sure how this app is categorized in FB, but its not showing up under photos, or searching for gallery in the FB applications list.
Cheers
Craig
Posts: 40
Select All/None: Fixed; only the top Select All/None was working. Now both are.
By trying to export your 1st album with 9 photos (id=23), I saw that only one photo had a title; that caused your problem. Since the caption field is optional in FB, I'll just change the application code to allow empty titles. It should work better now.
Also: I saw in the albums export of your Gallery that some albums have a line feed in their titles, which breaks the albums list. I updated the export_fb.php script to fix this.
Permissions: Yes, it's using 'guest' to list albums & photos.
The app is not showing in FB application directory because it has not been reviewed by FB yet. It's a long process. It will appear under Photos once it's approved.
- Guillaume Boudreau
Posts: 5
Yes you can. Using the call fetch-album-images, the reply should have image.title.ref-num, etc. G2 has a slightly different interface though.
Posts: 18
hey man!
you are a legend.. working sweet now.
FYI: it doesnt work for multisite.
this would break it:
require_once(dirname(__FILE__) . '/../bootstrap.inc');
require_once(dirname(__FILE__) . '/../init.inc');
only have config, embed, index and main.php files in root gallery folder w a multisite install.
would be nice.. but no worries
Posts: 40
Fixed. Re-download the export_fb.php script and put it in a 'fb' directory in your multisite install and it should work just fine now.
- Guillaume Boudreau
Posts: 2
very nice - thanks for the plugin
I noticed that the browser status bar says "waiting for gallery.dansleresau.com" all the time it's processing the imports... it doesn't bother me, particularly, but it would be interesting to know what this is doing?
Thanks again
Stephen
Posts: 40
The FB application is on that server. Facebook applications are remote applications, and in this case, simply use an IFRAME to show the web pages on my server, thus why your browser says it's loading that URL.
- Guillaume Boudreau
Posts: 2
Thanks for the explanation.
Stephen
Posts: 18
Does the facebook development platform provide for a way to import photos from facebook into gallery (basically the opposite of what this app does)? Many of my users are looking for a way to export their photos out of facebook and into gallery.
Posts: 40
Yes. facebook.photos.get will return URLs to photos in Facebook, so you could use that to import FB photos in Gallery.
- Guillaume Boudreau
Posts: 1
Sorry for posting something irrelevant guys, but I am new to facebook apps. I am trying to create that sample application that facebook has.
in my server directory, I have the following files:
appinclude.php , index.php , facebookapi_php5_restlib.php , facebook.php
----------------------------------
this is what I have inside index php:
<?php
require_once 'appinclude.php';
echo "<p>hello $user</p>";
-------------------------------------
this is appinclude.php:
<?php
require_once 'facebook.php';
$appapikey = 'I put my key here';
$appsecret = 'and secret here';
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();
//[todo: change the following url to your callback url]
$appcallbackurl = 'http://www.shervin.copperstream.co.uk/shaheen/';
//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
if (!$facebook->api_client->users_isAppAdded()) {
$facebook->redirect($facebook->get_add_url());
}
} catch (Exception $ex) {
//this will clear cookies for your app and redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($appcallbackurl);
}
------------------------------------------------------------------
so this is my call back url : http://www.shervin.copperstream.co.uk/shaheen/
and this is my canvas page: http://apps.facebook.com/shaheentest
side nav url : http://apps.facebook.com/shaheentest/index.php/
-----------------------------------------------------------------
However, when I try to add the application, I receive this error message:
The URL http://www.shervin.copperstream.co.uk/shaheen/index.php/?auth_token=023587bac7913619fe08d043ec11c99b&installed=1 did not respond
Could you please help me? I think you can probably spot the error in 2 seconds, but I'm a complete newbie.
Thanks.
Posts: 8
Is there a way of including a random image from Gallery in my FB profile? I don't really want to import everything to FB, although I can see the benefit of being able to tag the images etc.
Posts: 9
(YEAY! I've been looking for something like this for a looong time! so when i did my routine 'facebook' search-entry here after i came home from vacation a lot seemed to have happened... anyway...)
I'm with 'rhughes2270': i don't want all my 1200 pictures from my gallery in FB. i dont like storing the same thing 2 places (and allso: upploading my pictures to FB gives FB all the rights to ALL the pictures from my gallery. for eternity!).
so what i need is almost like RSS feed, but much fancier of course, on my FB-profile. since i'm not that computer skilled, I'm wondering if there is a "finished product" out there i can just install on my FB-profile?