Sha256: 183b685f72b620e39ffd6c0dad8a57b758b4b549d74c0a7bda7e0d4329dbe7fb
Contents?: true
Size: 577 Bytes
Versions: 10
Compression:
Stored size: 577 Bytes
Contents
module Nanoc::BinaryFilters class ImageScienceThumbnail < Nanoc::BinaryFilter identifier :image_science_thumbnail def run(file) require 'image_science' # Get temporary file path tmp_file = Tempfile.new('filter') tmp_path = tmp_file.path tmp_file.close # Create thumbnail ImageScience.with_image(file.path) do |img| img.thumbnail(@asset_rep.thumbnail_size || 150) do |thumbnail| thumbnail.save(tmp_path) end end # Return thumbnail file File.open(tmp_path) end end end
Version data entries
10 entries across 10 versions & 1 rubygems