Sha256: 6d7d5c300f04cf37f74825a25523f5a68917ee5868c2b0855461f9ad470f599e
Contents?: true
Size: 765 Bytes
Versions: 9
Compression:
Stored size: 765 Bytes
Contents
module Mill class Resource class Image < Resource include HTMLHelpers FileTypes = %w{ image/gif image/jpeg image/png image/tiff image/vnd.microsoft.icon image/svg+xml } attr_accessor :width attr_accessor :height def inspect super + ", width: %p, height: %p" % [ @width, @height, ] end def load info = ImageSize.path(@input_file.to_s) @width, @height = *info.size super end def img_html html_fragment do |html| html.img( src: uri, alt: @title, height: @height, width: @width) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems