Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/06/2011, 18:16
Avatar de hackcrack
hackcrack
 
Fecha de Ingreso: abril-2011
Mensajes: 331
Antigüedad: 13 años
Puntos: 9
Subir archivo a Picasa con api

Hola, necesito una mano para poder subir con php un archivo a picasa, por internet hay muy poca info, y en la web de picasa no entiendo un pomo como hacerlo porq no lo veo muy bien explicado, el codigo esta muy dividido y me termino perdiendo..

Tengo esto, pero me da error:

Código PHP:
<?php
$serviceName 
Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$user "mi user";
$pass "mi pass";

$client Zend_Gdata_ClientLogin::getHttpClient($user$pass$serviceName);

// update the second argument to be CompanyName-ProductName-Version
$gp = new Zend_Gdata_Photos($client"Google-DevelopersGuide-1.0");

// In version 1.5+, you can enable a debug logging mode to see the
// underlying HTTP requests being made, as long as you're not using
// a proxy server
// $gp->enableRequestDebugLogging('/tmp/gp_requests.log');

$username "hackcrack";
$filename "http://imghackcrack.files.wordpress.com/2011/06/descarga.png";
$photoName "My Test Photo";
$photoCaption "The first photo I uploaded to Picasa Web Albums via PHP.";
$photoTags "beach, sunshine";

// We use the albumId of 'default' to indicate that we'd like to upload
// this photo into the 'drop box'.  This drop box album is automatically 
// created if it does not already exist.
$albumId "default";

$fd $gp->newMediaFileSource($filename);
$fd->setContentType("image/jpeg");

// Create a PhotoEntry
$photoEntry $gp->newPhotoEntry();

$photoEntry->setMediaSource($fd);
$photoEntry->setTitle($gp->newTitle($photoName));
$photoEntry->setSummary($gp->newSummary($photoCaption));

// add some tags
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
$keywords->setText($photoTags);
$photoEntry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
$photoEntry->mediaGroup->keywords $keywords;

// We use the AlbumQuery class to generate the URL for the album
$albumQuery $gp->newAlbumQuery();

$albumQuery->setUser($username);
$albumQuery->setAlbumId($albumId);

// We insert the photo, and the server returns the entry representing
// that photo after it is uploaded
$insertedEntry $gp->insertPhotoEntry($photoEntry$albumQuery->getQueryUrl()); 
?>