public function filter_post_picasa_images($out, $post) { try { // Check if there is any album requested $albumname = $post->info->picasa_album; if (!isset($albumname) || empty($albumname)) { return $out; } // TODO: Size to post options $size = "s200"; //Check if the photos are already cached first because then we're already finished if (Cache::has(array(__CLASS__, "album_{$albumname}"))) { return Cache::get(array(__CLASS__, "album_{$albumname}")); } $picasa = new Picasa(); $picasa->userid = $post->user_id; $this->cache_albumlist(); $albumids = Cache::get(array(__CLASS__, "picasa_albumids")); $albumlinks = Cache::get(array(__CLASS__, "picasa_albumlinks")); // Get the actual photos $xml = $picasa->get_photos(array("album" => $albumids[$albumname])); foreach ($xml->entry as $photo) { // Warum drei URLs? // TODO: Irgendwas mit thumbnails machen $media = $photo->children('http://search.yahoo.com/mrss/'); // $props['thumbnail_url'] = (string)$media->group->thumbnail->attributes()->url; $props['title'] = (string) $media->group->title; $props['description'] = (string) $media->group->description; $src = (string) $photo->content->attributes()->src; $props['url'] = substr($src, 0, strrpos($src, '/')) . "/{$size}" . substr($src, strrpos($src, '/')); $props['picasa_url'] = $src; $photos[] = $props; } // TODO: Add cache expire option to the admin interface Cache::set(array(__CLASS__, "album_{$albumname}"), $photos, 60 * 60 * 24); } catch (exception $e) { $photos = array(_t(vsprintf("No photos available or an error occured. Sometimes reloading the page helps. %s", $e), __CLASS__)); } return $photos; }