Guest User

Untitled

a guest
Jun 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. require 'rubygems'
  2. require 'carrierwave'
  3. require 'fileutils'
  4.  
  5. # needed for the RMagick module in CarrierWave
  6. def current_path
  7. @current_path
  8. end
  9.  
  10. include CarrierWave::RMagick
  11.  
  12. original_path = "/Users/kevinsmith/Desktop/carrierwave/images"
  13. modified_path = "/Users/kevinsmith/Desktop/carrierwave/modified"
  14. w = 262
  15. h = 262
  16.  
  17. Dir.chdir(original_path)
  18.  
  19. Dir['*'].each do |f|
  20. FileUtils.cp(File.join(Dir.pwd, f), modified_path)
  21. @current_path = File.join(modified_path, f)
  22.  
  23. #resize_to_fit(w, h)
  24. resize_to_fill(w, h, ::Magick::NorthWestGravity)
  25. #resize_and_pad(w, h, :transparent, ::Magick::CenterGravity)
  26. #resize_to_limit(w, h)
  27. end
Add Comment
Please, Sign In to add comment