how can i detect when flickr photos become unavailable? - ruby

How can I tell programatically when an embedded/blogged flickr image is replaced with a "photo no longer available" image?
With Ruby if possible.

You could use the Flickr flickr.photos.getPerms API method with the photo ID extracted from any URLs you have.
http://www.flickr.com/services/api/flickr.photos.getPerms.html
This would tell you if the photo is missing or has had it's permissions changed to prevent public viewing.
Various Ruby wrappers are available for the Flickr API.

Related

Find out which album(s) a photo is in in Google Photos API

I am using the Google Photo API, https://developers.google.com/photos/library/reference/rest
I am using get successfully to get information about a media (a photo). However, I really really need to know WHICH albums the photo is in (it cam be multiple).
Is there any way to do this? Am I missing something?
You can get all albums first and then get photos through https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search
by adding the parameter of albumId.

IMDB Poster URL Returns Referral Denied

In my Ruby on Rails app, I use the imdb gem (https://rubygems.org/gems/imdb) to search for a movie by title and grab the poster url and add it to the movie model I have in my database. Then in my view, I put that url in an image source tag and display the image to the user.
I don't have any problems when I'm running my application locally, but when I deploy it to Heroku, sometimes a few images are rendered successfully but for the most part, they aren't displayed properly. I've tried multiple browsers and as it turns out when I try to load the image, I get a "Referral Denied" message saying:
You don't have permission to access "[poster url here]" on this server. Reference #[some ref. number here]
How would I go about fixing this? I'm guessing it's because the IMDB server is denying my access because either I'm making too many requests from my application or because my application doesn't have the necessary credentials to get the data or maybe some combination of both. Is there a way to bypass this at all?
IMDB blocks the direct linking of images from their site on other sites, I think this previous question covers the topic.
The easiest way to get around this is to download the image and host it yourself rather than linking IMDB's copy. Alternatively you could investigate alternative movie DBs to see if they can offer what you want - the answers to this question on IMDB APIs lists a few. The Movie DB API looks like a good bet.

Given a URL of an image, how do I upload that image to the Facebook user's album? [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Upload photo to users profile from photo URL, not input file field
I have the access_token. It's with the publish_stream permission.
Alright, now I want to upload an image to my default app's album on Facebook. The image is hosted on my S3.amazon.com. (but for example purposes, let's take this link: http://i.imgur.com/Ptyzk.jpg)
How can I upload this imgur image to my app's album? (documentation on Facebook is weird, and I don't understand PHP).
To upload photo to "Application Album" you have two ways (actually first may interest you more).
Option 1: Uploading Photos to the Graph API via a URL:
App developers who host their images on Amazon S3 or a similar service can pass the S3 URL directly to Facebook without having to download the file to their application servers only to upload it again to Facebook. This improves performance and reduces costs for developers.
To achieve this you need to issue POST request (or GET with argument method=post) to next URL:
https://graph.facebook.com/me/photos?
access_token=...&url=http%3A%2F%2Fi.imgur.com%2FPtyzk.jpg
http://i.imgur.com/Ptyzk.jpg in url encoded form is http%3A%2F%2Fi.imgur.com%2FPtyzk.jpg (you only need to encode url if you passing it withing URL arguments, and must not encode if you passing it with post-data).
As stated in photo object documentation, by posting photo to https://graph.facebook.com/USER_ID/photos:
The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
Option 2: Uploading image data
You just need to issue POST request to http://graph.facebook.com/me/photos (see Create Photos section of user object documentation).
The only required parameter is source which is multipart/form-data encoded file, you can either download it to temporary file and upload it later, or stream it to the Graph API (depending on technology you use to implement this functionality)
There is couple of samples how to upload photo (in languages other than PHP):
Android SDK samples (Hackbook)
Facebook C# SDK (on Codeplex)
Update:
It's not really clear where do you want photo to be published User's album or Application album (title and body of question are opposite on this). If you want to publish it to User's album you need to replace me with id of album you want photo be uploaded to. Otherwise use me (for current user) or other user id (this will require usage of application access_token).
This tutorial does exactly that:
https://developers.facebook.com/blog/post/498/
You can choose which album you want to upload the picture to.
If you want to do it on a more generic way, Facebook API tells you to issue a POST request to ALBUM_ID/photos with source and message parameters. Note that source must be of multipart/form-data type.
More details at https://developers.facebook.com/docs/reference/api/album/
I think the majority of this answers are correct if you would like to upload that photo to a user of your app. But as I understand you want to upload it to your app's connected album. To do that you should get you app album's id than you'll be able to post an image to it like:
$facebook->api('album_id', 'POST', array(...
To get the id of the album go to the Graph API explorer and do a GET to: /your_app_id/albums (replace your_app_id with your actual app id). That should give you all the details about your app albums. Than do a Graph API POST request using your preferred SDK (JS, PHP etc.) with the array containing the picture source and a title (this are mandatory) to the above address.
NOTICE: The album application connection is deprecated and will be removed on March 1st, 2012. Read more at the end of this doc http://developers.facebook.com/docs/reference/api/application/

Social Plugins for Facebook Photos and Albums

Is it possible to use Social Plugins such as the Comments and Like plugins to display the comments and likes for a photo or album uploaded to Facebook?
I have tried various URLs for the HREF attribute (the photo source, the photo page, the graph URL, etc) and cannot get the plugin to display existing comments against the photo. Can someone suggest the correct URL (if any) that I should use?
I can get access to the list of comments using the graph API, however I would prefer to make use of the social plugins if possible.
Currently you can not use them in that manner. You can use the graph api to read and write comments, read and add albums and photos.
https://developers.facebook.com/docs/reference/api
This is somewhat involved and requires knowledge of coding.
I personally have been working on a Feed for the wall, and for albums and have to say it was no easy task. https://apps.facebook.com/AnotherFeed

Extend iPhoto to post pictures to a different web service?

Currently iPhoto lets me upload pictures to Facebook and Flickr.
Is there any way (perhaps write a plugin) to extend this so that I can post photos to a different web service e.g. Picasa?
Its possible. If you are looking for a Picasa plugin, though, Google already has one (I haven't used it in the current version of iPhoto). If you are looking to develop your plugins, this article might help.

Resources