All of the tutorials I've found for creating Picasa albums and uploading pictures use the Zend Framework which I haven't studied.
Is it possible to upload images and create albums using PHP and cURL?
My images are stored in the directory e:/images
and the image information is stored in a MySQL table like this:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE IF NOT EXISTS `picasaimage` (
`id` bigint(1) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`content` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tags` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`license` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`image_path` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`width` int(4) COLLATE utf8_unicode_ci NOT NULL,
`height` int(4) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
I'm getting the Google Client authentication code using the following code:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$data = array('accountType' => 'GOOGLE',
'Email' => 'youremailaddress@gmail.com',
'Passwd' => 'yourpassword',
'source'=>'PHI-cUrl-Example',
'service'=>'lh2');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$hasil = curl_exec($ch);
echo $hasil;
//SID=DQA...oUE
//LSID=DQA...bbo
//Auth=DQA...Sxq
?>
Can anyone give some guidance on creating an album named test
and uploading the images to it?
EDIT1:
How to add photo license when I upload photos with php scripts?
reference on http://commons.wikimedia.org/wiki/Commons:Picasa_Web_Albums_files
Creative Commons Attribution 3.0 Unported (CC-BY)
Creative Commons Attribution-Share Alike 3.0 Unported
Unlicensed
Creative Commons Attribution-Noncommercial 3.0 Unported
Creative Commons Attribution-No Derivative Works 3.0 Unported
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported
Check the response data from api get album photo, there should be have something like:
"gphoto$license":{
"$t":"ATTRIBUTION_NON_COMMERCIAL_NO_DERIVATIVES",
"id":3,
"name":"Attribution-Noncommercial-No Derivative",
"url":"http://creativecommons.org/licenses/by-nc-nd/3.0"
},