×
Namespaces

Variants
Actions
Revision as of 09:30, 22 November 2011 by hamishwillee (Talk | contribs)

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

Ovi Upload photos in PHP5

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

This script is a wrapper around class.ovi.php that allows easy uploading of JPEG images from the command line to Share on Ovi. This code is based on Mac Os 10.4 but will give the basis for using on other O/S as PHP is available across several operating systems.

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

  * UploadToOvi - A PHP script, to use class.ovi.php to upload photos from the command line.
*
* This script is a wrapper around class.ovi.php that allows easy uploading of JPEG images
* from the command line to Share on Ovi. Using Platypus (http://sveinbjorn.org/platypus)
* under Mac OS X, you can use this script to create a droplet for uploading images. For
* instructions on how to do this, see http://wiki.ruk.ca/wiki/Creating_a_Share_on_Ovi_Droplet
*
* 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/)
* - growlnotify (optional - see http://growl.info/documentation/growlnotify.php)
* - a Share on Ovi account
*
* Usage example:
*
* ./UploadToOvi.php myimage1.jpg myimage2.jpg
*
* 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://wiki.ruk.ca/wiki/Creating_a_Share_on_Ovi_Droplet
* @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
*/
 
$ovi_username = ""; // Set to your Share on Ovi username.
$ovi_password = ""; // Set to your Share on Ovi password.
$ovi_usegrowl = true; // Set to true to use Growl to display a notification when image has been uploaded.
 
require_once("class.ovi.php"); // must be in the PHP include_path
 
$son = new ShareOnOvi($ovi_username,$ovi_password);
 
for($i = 1 ; $i < sizeof($argv) ; $i++) {
if (file_exists($argv[$i])) {
// This is an imperfect way of determining whether this is actually a JPEG
if (substr($argv[$i],-3,3) == "jpg") {
$title = basename($argv[$i],".jpg");
$son->Upload($argv[$i],$title,"",array(),"public");
if (file_exists("/usr/local/bin/growlnotify") and ($ovi_usegrowl)) {
$command = "/usr/local/bin/growlnotify -n 'UploadToOvi' --image '" . $argv[$i] . "' -m 'Uploaded'";
exec($command);
}
}
}
}
This page was last modified on 22 November 2011, at 09:30.
44 page views in the last 30 days.
×