Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Ovi Upload photos in PHP5

From Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file: UploadToOvi.php
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 (
* under Mac OS X, you can use this script to create a droplet for uploading images. For
* instructions on how to do this, see
* Requirements for use:
* - PHP 5 or greater
* - class.ovi.php (
* - class.wsse.php (available from
* - growlnotify (optional - see
* - 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
* 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
* @version 1.0, July 13, 2008
* @link
* @link Share on Ovi website
* @author Peter Rukavina <>
* @copyright Copyright &copy; 2008, Reinvented Inc.
* @license 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");
if (file_exists("/usr/local/bin/growlnotify") and ($ovi_usegrowl)) {
$command = "/usr/local/bin/growlnotify -n 'UploadToOvi' --image '" . $argv[$i] . "' -m 'Uploaded'";
This page was last modified on 22 November 2011, at 06:30.
28 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.