×
Namespaces

Variants
Actions
Revision as of 05:58, 12 October 2011 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Flicker to Ovi PHP5 - flickr2ovi.php

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file: flickr2ovi.php
Article
Created: Peter Rukavina (27 Feb 2009)
Last edited: hamishwillee (12 Oct 2011)

This script is a wrapper around class.ovi.php that allows for the migration of a single user's public Flickr photos into Share on Ovi.

The code is by Peter Rukavina who has kindly given permission to use this script here and comes from his website.

/**#!/usr/bin/php -q */
/**
* flickr2ovi.php - A PHP script to migrate photos from Flickr to Share on Ovi.
*
* This allows for the migration of a single user's public Flickr photos into Share on Ovi.
* For each image the title, description and tags are migrated, along with the original
* version of the image itself (complete with any EXIF data embedded).
*
* Requirements for use:
*
* - PHP 5 or greater
* - class.ovi.php (http://websvn.reinvented.net/wsvn/Plazes/Ovi/class.ovi.php)
* - class.wsse.php (available from http://www.dentedreality.com.au/phpatomapi/)
* - Addicted to Flickr (available from http://addictedtonew.com/examples/flickr/)
* - a Flickr account with an API key (see http://www.flickr.com/services/api/keys/)
* - a Share on Ovi account
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* @version 1.0, July 13, 2008
* @link http://share.ovi.com/ Share on Ovi website
* @author Peter Rukavina <peter@rukavina.net>
* @copyright Copyright &copy; 2008, Reinvented Inc.
* @license http://www.fsf.org/licensing/licenses/gpl.txt GNU Public License
*/

 
//----- user configurable options -----
 
$ovi_username = ""; // Set to your Share on Ovi username.
$ovi_password = ""; // Set to your Share on Ovi password.
$ovi_channel = "public"; // Set to the Share on Ovi "channel" you want to upload into.
 
$flickr_apikey = ''; // Set to your Flickr API key (see http://www.flickr.com/services/api/keys/)
$flickr_userid = ''; // Set to the Flickr User ID you want to grab photos from (see http://www.flickr.com/services/api/explore/?method=flickr.people.getPublicPhotos)
 
$howmanyphotos = 2; // Set to the number of photos you want to grab (most recent first).
$startpage = 1; // Set to the "page" of photos you want to start grabbing from.
 
//----- end of user configurable options -----
 
require_once 'class.flickr.php';
require_once 'class.ovi.php';
 
$son = new ShareOnOvi($ovi_username,$ovi_password);
 
$flickr = &new flickr($flickr_apikey);
 
$result = $flickr->getUsersPublicPhotos($flickr_userid,$startpage,$howmanyphotos);
 
if ($flickr->isError()) {
die($flickr->getErrorMsg());
}
else {
foreach ($result['photos'] as $id => $meta) {
 
print "<< Flickr: " . $meta['title'] . "\n";
 
$info = $flickr->getPhotoInfo($id);
 
$filename = "http://farm" . $info['farm'] . ".static.flickr.com/" . $info['server'] . "/" . $info['id'] . "_" . $info['originalsecret'] . "_o.jpg";
 
$ovi_tags = array();
foreach($info['tags'] as $key => $value) {
$ovi_tags[] = $info['tags'][$key]['tag'];
}
 
$title = $meta['title'];
$summary = $info['description'];
$tags = $ovi_tags;
$channel = $ovi_channel;
 
$ovi_url = $son->Upload($filename,$title,$summary,$tags,$channel);
 
print ">> Ovi  : " . $ovi_url . "\n";
}
}
This page was last modified on 12 October 2011, at 05:58.
90 page views in the last 30 days.
×