Sha256: b65c667cb983d9af666abf88f139e3d8876803ad2c9dd8feb651b2fd8ec540b4
Contents?: true
Size: 597 Bytes
Versions: 2
Compression:
Stored size: 597 Bytes
Contents
require 'fastimage' require 'uri' module SpriteAnimationUtil #:nodoc: all class ImageSize def self.size(image_src) FastImage.size(parse_image_path(image_src), :raise_on_failure => true) end private def self.parse_image_path(image_src) if uri?(image_src) image_src else ::Rails.root.to_s+"/app/assets/images/#{image_src}" end end def self.uri?(string) uri = URI.parse(string) %w( http https ).include?(uri.scheme) rescue URI::BadURIError false rescue URI::InvalidURIError false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprite_animation-0.3.0 | lib/sprite_animation/sprite_animation_util.rb |
sprite_animation-0.2.0 | lib/sprite_animation/sprite_animation_util.rb |