「Fastimage」の版間の差分
提供: sha.ngri.la
細 (→使い方) |
細 |
||
5行目: | 5行目: | ||
==使い方== | ==使い方== | ||
− | < | + | <pre> |
− | |||
require 'fastimage' | require 'fastimage' | ||
19行目: | 18行目: | ||
FastImage.size("http://upload.wikimedia.org/wikipedia/commons/b/b4/Mardin_1350660_1350692_33_images.jpg", :raise_on_failure=>true, :timeout=>2.0) | 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] | => [9545, 6623] | ||
− | </ | + | </pre> |
− |
2014年8月12日 (火) 10:49時点における版
インストール
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]