「Fastimage」の版間の差分
提供: sha.ngri.la
細 |
細 |
||
19行目: | 19行目: | ||
=> [9545, 6623] | => [9545, 6623] | ||
</pre> | </pre> | ||
+ | |||
+ | [[Category:Ruby]] | ||
+ | [[Category:Ruby On Rails]] |
2014年8月12日 (火) 10:50時点における版
インストール
gem install fastimage
使い方
require 'fastimage' FastImage.size("http://stephensykes.com/images/ss.com_x.gif") => [266, 56] # width, height FastImage.type("http://stephensykes.com/images/pngimage") => :png FastImage.type("/some/local/file.gif") => :gif FastImage.size("http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg", :raise_on_failure=>true, :timeout=>0.1) => FastImage::ImageFetchFailure: FastImage::ImageFetchFailure FastImage.size("http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg", :raise_on_failure=>true, :timeout=>2.0) => [9545, 6623]