「Fastimage」の版間の差分
提供: sha.ngri.la
(ページの作成:「==インストール== <pre> gem install fastimage </pre> ==使い方== <nowiki> <textarea> require 'fastimage' FastImage.size("http://stephensykes.com/images/ss.com_...」) |
細 (→使い方) |
||
5行目: | 5行目: | ||
==使い方== | ==使い方== | ||
+ | <textarea> | ||
<nowiki> | <nowiki> | ||
− | |||
require 'fastimage' | require 'fastimage' | ||
19行目: | 19行目: | ||
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] | ||
+ | </nowiki> | ||
</textarea> | </textarea> | ||
− |
2014年8月12日 (火) 10:42時点における版
インストール
gem install fastimage
使い方
<textarea> 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] </textarea>