Hi Jeff,
Here is the code that I am working with, it's essentially the code
provided by the developer's guide. This is enough to max out my 16MBs
of memory.
There are 28 photos, all of dimensions 800x533 px, totaling a size of
2MB.
Trying to retrieve all photos creates a memory limit error.
Setting setMaxResults to 21 prevents the memory error, but naturally
only returns 21 photos.
Is there something I am overlooking?
Cheers,
Mike
Code:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Photos');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$user = "username";
$pass = "password";
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,
$serviceName);
$gp = new Zend_Gdata_Photos($client, "Google-DevelopersGuide-1.0");
try {
$query = $gp->newAlbumQuery();
$query->setUser("default");
$query->setAlbumId( $theAlbumID );
$albumFeed = $gp->getAlbumFeed($query);
foreach ($albumFeed as $albumEntry) {
if ($albumEntry->getMediaGroup()->getContent() != null){
$url = $albumEntry->getMediaGroup()->getContent();
$url = $url[0]->getUrl();
print $url . '<br />';
}
}
} catch (Zend_Gdata_App_HttpException $e) {
echo "Error: " . $e->getMessage() . "<br />\n";
if ($e->getResponse() != null) {
echo "Body: <br />\n" . $e->getResponse()->getBody() .
"<br />\n";
}
echo "Request: <br />\n" . $e->getRequest() . "<br />\n";
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getMessage() . "<br />\n";
} catch( Zend_Uri_Exception $e){
echo $e;
}
On Mar 5, 7:04 pm, Jeff Fisher <[email protected]> wrote:
> Hi Mike,
>
> When you say you are "getting" the photos, do you mean you are
> processing the feed and fetching the binary image contents of each
> full-size image into memory? I would find it hard to believe that just
> retrieving the albumFeed XML would use over 16MB of memory, though if
> that's the case we have a pretty serious problem.
>
> Some basic code to show your algorithm would be helpful here.
>
> Cheers,
> -Jeff
>
> On Mar 5, 6:33 am, mp111 <[email protected]> wrote:
>
> > Hi,
>
> > When I use an albumFeed to get all the photos in an album I exhaust my
> > php memory limit:
>
> > Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to
> > allocate 72 bytes) in /data/www/sites/.../library/Zend/Gdata/App/
> > Base.php on line 407
>
> > This is with an album of 25 images.
>
> > I solved this by upping my memory_limit, however I don't see this to
> > be a safe solution - in the future my album will have more photos and
> > I cannot continually raise the memory limit.
>
> > Is anyone else having any issues like this? I cannot seem to find
> > information about it?
>
> > Thanks, Mike.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---