473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Upload image to picasaweb from our site(php) without goin to picasaweb site

1 New Member
Hi everyone,

my main purpose now is to upload photo(s) to picasaweb album from my own website (without surfing to google site) and retrieve back the image URL(s) by php coding. I found a sample from (http://www.ibm.com/developerworks/library/x-picasalbum/) which is using zend library, its works fine all the while but I met this error last day when i uploading a photo:-

Error: HTTP/1.1 400 Bad Request Expires: Thu, 19 Aug 2010 04:14:17 GMT Date: Thu, 19 Aug 2010 04:14:17 GMT Cache-control: private, max-age=0, must-revalidate Set-cookie: _rtok=ySBu81XkS7zR; Path=/; HttpOnly Set-cookie: S=photos_html=6f3_NANwyaefHBbxwRQKMQ; Domain=.google.com; Path=/; HttpOnly Content-type: text/html; charset=UTF-8 X-content-type-options: nosniff X-frame-options: SAMEORIGIN X-xss-protection: 1; mode=block Server: GSE Connection: close A title or Slug header is required

I had updated zend lib and I pretty sure that this coding is usable to upload picture(s). However, the other 2 coding provided from the website is still usable (listing photo,deleting photo in album).

Hereby, can anyone can help me to solve out this error? Or any other sample code I can refer to? Thanks for viewing :)

//my php code for photo upload

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Photos');
Zend_Loader::loadClass('Zend_Http_Client');

// connect to service
$svc = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$user = "xxx";
$pass = "xxx";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $svc);
$gphoto = new Zend_Gdata_Photos($client);

// validate input
if (empty($_POST['title'])) {
die('ERROR: Missing title');
}

// sanitize input
$title = htmlentities($_POST['title']);
$tags = htmlentities($_POST['tags']);

// set album name
$albumName = "xxx";

// construct photo object
// save to server
try {
$photo = $gphoto->newPhotoEntry();

// set file
$file = $gphoto->newMediaFileSource($_FILES['photofile']['tmp_name']);
$file->setContentType("image/jpeg");
$photo->setMediaSource($file);

// set title
$photo->setSummary($gphoto->newSummary($title));

// set tags
$photo->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
$keywords->setText($tags);
$photo->mediaGroup->keywords = $keywords;

// link to album
$album = $gphoto->newAlbumQuery();
$album->setUser($user);
$album->setAlbumName($albumName);

// save photo
$gphoto->insertPhotoEntry($photo, $album->getQueryUrl());
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getResponse();
}
echo 'Photo successfully added!';
}
Aug 19 '10 #1
0 1227

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
4
by: Kevin | last post by:
for uploading image, I can use System.Web.UI.WebControls.HtmlInputFile libary in codebehind. but if resolution size is too big, I want to resize the picture to 800X600 and then do upload(save...
6
by: Darkbyte [Work] | last post by:
Hi everybody!!! I have a script (foo.php) which uses GD to create an image and sends it to the browser: <?php $img = imagecreatefrompng("mypng.png"); /* other stuff */ ...
3
by: vikas2923 | last post by:
Hi , Can any one tell me how to upload image without using persits software(I am using ASP and SQl server 2000 as backend),kindly provide me the code thanx
6
by: Lorenzo Thurman | last post by:
Does anyone know how to validate a particular image type using PHP? If I have a file and I want to ensure that it is a jpeg, how would go about it? A sort of is_jpeg or is_gif is what I'm seeking....
5
chunk1978
by: chunk1978 | last post by:
hi there... i have the following codes (HTML and PHP) on my Apache Localhost: HTML: titled "Form.html" <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input...
0
by: aris1234 | last post by:
hello.. How to upload image file in page update ..?? i have logic like this : if user upload new image then old image must delete and update DB used new name if user not upload new image then...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
1
by: info | last post by:
For fingerprint images WSQ (Wavelet Scalar Quantization) is superior to other lossy compression methods, such as JPEG, and was chosen by FBI (U.S. Federal Bureau of Investigation) as the...
5
by: rahia307 | last post by:
Hi I am using this code for upload image. <table> <form action="process.php method="POST" enctype="multipart/form-data"> <tr> <td align="right">Image1 :</td> <td><input type="file"...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.