Ok, so I am working with the plain Picasa API in PHP. (Not zend, just http calls). I am authenticated and can browse through albums and select photos.
The problem I am facing now is that I have a URL where a picture exists and I want to retrieve that picture's binary data with php. So far I have tried the samples below, but none of them downloaded any data.
$url = 'https://lh6.googleusercontent.com/-T4v5svsA3JU/Tc7jEchmSYI/AAAAAAABAb8/MLXlXjKUyIg/s1024/Dies09_080509_5144.JPG';
$file = file_get_contents($url);
echo $file;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
So, how can I retrieve the binary data of a photo from Picasa?
What kind of error did you get when using the first method? I've tested the code below and it works properly for me. This will output the image resized to a width of 250 px.
$url = 'https://lh6.googleusercontent.com/-T4v5svsA3JU/Tc7jEchmSYI/AAAAAAABAb8/MLXlXjKUyIg/s1024/Dies09_080509_5144.JPG';
$file = file_get_contents($url);
$im = imagecreatefromstring($file);
$im = imagescale($im, 250);
header('Content-Type: image/jpg');
imagejpeg($im);