Phlickr がひどい
認証してFlickrからプライベートの写真も取ってくるのを作ってるんだけど、そのために使ったPEARライブラリのPhlickrがけっこうバグだらけで苦労した。
Flickr Services
http://www.flickr.com/services/api/misc.urls.html
画像のURLを割り出す機能が↑Flickrの仕様に沿ったURLを返すようになってない。
Phickrで写真が取得できない buildImgUrl()挙動 (kakitomeru note)
http://www.smallmake.com/note/2008/04/phickr_buildimgurl.html
↑の問題。
で、↑の対処にプラスして、Phlickr/Photo.php の
$url = sprintf("http://farm%d.static.flickr.com/%d/%d_%s%s.%s",
$this->getFarm(), $this->getServer(), $this->getId(), $this->getSecret(), $sizeStr, $type);
の部分を
$url = sprintf("http://farm%d.static.flickr.com/%d/%s_%s%s.%s",
$this->getFarm(), $this->getServer(), $this->getId(), $this->getSecret(), $sizeStr, $type);
にしたら治った。
$this->getId() の部分が、全部特定の数字になってしまうという問題に悩まされたんだけど、sprintf の%d を %s に変更したらなおった。
誰か英語で通報しておいてクレー。