Roel Veldhuizen
Roel Veldhuizen

Reputation: 4723

How to get the actual image from Picasa using Gdata

I am trying to output the actual URL to the high resolution image of a photoentry. A photo entry Zend_Gdata_Photos_PhotoEntry of the Gdata contains the data of photo stored in Picasa.

Currently, I found to methods to output URLs to images. The first is to output thumb images, they seem to be available in three different sizes. The second method is by getContent(). I expected that this method should get me the highest resolution URL. Instead, it contains one image url which is still smaller than the original in Picasa.

    $thumb = $entry->getMediaGroup()->getThumbnail();
    $content = $entry->getMediaGroup()->getContent();

    echo "<img src='" . $content[0]->getUrl() . "' />";      
    echo "<img src='" . $thumb[1]->getUrl() . "' />";     

Upvotes: 2

Views: 1583

Answers (3)

marhensa
marhensa

Reputation: 11

It might be simpler, change the size on url from sXXX to s0

enter image description here

to

enter image description here

Upvotes: 1

Xtophe
Xtophe

Reputation: 2277

When building your query, add the setImgMax parameter as follows:

$query = $gp->newAlbumQuery();
$query->setUser($user);
$query->setAlbumId($album);
$query->setImgMax("d");

This way you will get the highest resolution available of the photo using the same code you posted.

Upvotes: 3

Robert Rowntree
Robert Rowntree

Reputation: 6289

same question here

Outside of the php / zend aspect, it can help to understand the underlying abstract protocol for gdata/ picasa. I assume your provider for photos is picasa..

Regardless of the language that you are writing in, you can use generic tools like the playground in order to make tests exercising the protocol and to further understand all the aspects of the back and forth of the API you are trying to use.

The hi-res picture is in media:group/media:content[@url]

The other link has a long answer that shows how to do a GET against the api for a particular user/ album/ photo and how to find the tag containing the URL that you want.

Upvotes: 1

Related Questions