Module: Jekyll::Filters::Width
- Defined in:
- lib/jekyll/filters/width.rb
Overview
Obtain image width
Instance Method Summary collapse
Instance Method Details
#width(input) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jekyll/filters/width.rb', line 7 def width(input) return unless input path = @context.registers[:site].in_source_dir input unless ::File.exist? path Jekyll.logger.warn "File doesn't exist #{input}" return input end Jekyll::Images::Cache.cached_image(path).width rescue Vips::Error => e Jekyll.logger.warn "Failed to process #{input}: #{e.}" nil end |