Closed ohac closed 14 years ago
diff --git a/lib/plugins/w3mimg.rb b/lib/plugins/w3mimg.rb
index 10868a6..ee4d23c 100644
--- a/lib/plugins/w3mimg.rb
+++ b/lib/plugins/w3mimg.rb
@@ -28,6 +28,8 @@ def get_icon_path(s)
rimage = Magick::Image.from_blob(image).first
rimage = rimage.resize_to_fill(48, 48)
f << rimage.to_blob
+ rescue Magick::ImageMagickError
+ return nil
rescue Net::ProtocolError
return nil
end
こんな感じかな?
そのときの ~/.termtter/tmp/user_profile_images/prototechno.png は 0 バイトでした。 サンタアイコンを元に戻したときにエラーが出るようになった。 このファイルを消して再起動してみましたが、また0バイトのファイルができた。 wgetではgetできる。
再現用のコード。どうやらアニメpngをRMagickがうまく処理できてないっぽい。
require 'RMagick'
require 'uri'
require 'net/http'
url = 'http://a1.twimg.com/profile_images/591916558/3tomoe_normal_bigger_normal.png'
http_class = Net::HTTP
uri = URI.parse(URI.escape(url))
image = http_class.get(uri.host, uri.path, uri.port)
p image.size
Magick::Image.from_blob(image)
b4704c0ea6e910f17c976fc0d282a0c09491df4e
とりあえずメモ: