lib/imageprep/resize.rb
# Constant Widths define the sizes that we need the images created at for 
# picturefill [retina](http://duncandavidson.com/blog/2012/08/retina_ready/)
Constant Widths define the sizes that we need the images created at for
picturefill [retina]
Constant Widths define the sizes that we need the images created at for picturefill [ retina ]
def resize_image(jpg_file)
      md = ImagePrep::MetaData.new(jpg_file)
      resized_image_path_partial = File.join(@root, "generated", md.root, md.slug_name)
      FileUtils.mkpath(File.dirname(resized_image_path_partial))
      WIDTHS.each do |width|
        sized_image_name = resized_image_path_partial + "-#{width}x#{width}" + md.ext
        resized_names << sized_image_name
        next if File::exists?(sized_image_name)
        image = MiniMagick::Image.open(jpg_file)
        image.resize("#{width}")         
        image.quality(JPEG_COMPRESSION_QUALITY)
        image.write(sized_image_name)
      end
    end
def resize_image ( jpg_file ) md = ImagePrep :: MetaData . new ( jpg_file ) resized_image_path_partial = File . join ( @root , "generated" , md . root , md . slug_name ) FileUtils . mkpath ( File . dirname ( resized_image_path_partial ) ) WIDTHS . each do | width | sized_image_name = resized_image_path_partial + "-#{width}x#{width}" + md . ext resized_names << sized_image_name next if File :: exists? ( sized_image_name ) image = MiniMagick :: Image . open ( jpg_file ) image . resize ( "#{width}" ) image . quality ( JPEG_COMPRESSION_QUALITY ) image . write ( sized_image_name ) end end
Constant Widths define the sizes that we need the images created at for
picturefill [retina](http://duncandavidson.com/blog/2012/08/retina_ready/)
Constant Widths define the sizes that we need the images created at for picturefill [ retina ] ( http : // duncandavidson . com / blog / 2012 / 08 / retina_ready / )
# Need to keep reloading image because we are resizing it # need to pass "width" as a string to the mini_magick resize gem
jpg_file
<not_specific>