How to post photos in flickr through API and PHP

November 6, 2009 at 11:29 am 3 comments

Hi All,

Now its very easy to upload photos in flickr from your own site or application.  This can be done through the help of  phpFlickr class.  This can be downloaded from http://phpflickr.com or directlink for downloading  is http://code.google.com/p/phpflickr/downloads/list

Including this class in following code you can easily upload images in your flickr account.

<?php
include(“phpFlickr.php”);

$api_key= “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;

$api_secret= “XXXXXXXXXXXX”;

$flickr = new phpFlickr($api_key, $api_secret,true);

$flickr->auth(“write”);

//you can use relative path here too like /home/example/public_html/snaps/a.jpg
$path=”a.jpg”;

$response=$flickr->sync_uploa d(“$path”,”put your description here”,”mytag1,mytag2″,1,1,1);

//returns the id of the image that is posted in flickr
if($response)
{
header(“Location:http://flickr.com”);
exit();
}

?>

While executing this code, flickr  asks you for a yahoo login (If not logged in).After login it  asks  you to allow the application to access your flickr accaount. Once you allow this, the image is posted in flickr and the script gives you the image id of the posted image.

Then it redirects you to the flickr to show the picture you posted.

Thanks!

Advertisement

Entry filed under: API. Tags: , , , .

How to develop a twitter application through twitter API How to write file without 777 permission

3 Comments Add your own

  • 1. Zorra_plateada  |  December 9, 2009 at 9:41 pm

    Dear Author phpwala.wordpress.com !
    There is something similar?

    Reply
  • 2. Thibault  |  February 24, 2010 at 8:48 pm

    I had a lot of hope when I saw this article and finally its doesn’t work too. Same probleme again and again : Oups ! Flickr n’a pas trouvé d’URL de rappel valide.

    Reply
    • 3. Hitesh Mathpal  |  February 27, 2010 at 7:03 pm

      can u plz share with me where u r facing the problem?

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed



Follow

Get every new post delivered to your Inbox.