Compare with Previous | Blame | View Log
#!/usr/bin/php -q
<?php
/**
* 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://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://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 © 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);
}
}
}
}