Created
October 15, 2010 15:59
-
-
Save kvnsmth/628432 to your computer and use it in GitHub Desktop.
Just some code that I threw together to play around with CarrierWave's image manipulation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'carrierwave' | |
require 'fileutils' | |
# needed for the RMagick module in CarrierWave | |
def current_path | |
@current_path | |
end | |
include CarrierWave::RMagick | |
original_path = "/Users/kevinsmith/Desktop/carrierwave/images" | |
modified_path = "/Users/kevinsmith/Desktop/carrierwave/modified" | |
w = 262 | |
h = 262 | |
Dir.chdir(original_path) | |
Dir['*'].each do |f| | |
FileUtils.cp(File.join(Dir.pwd, f), modified_path) | |
@current_path = File.join(modified_path, f) | |
#resize_to_fit(w, h) | |
resize_to_fill(w, h, ::Magick::NorthWestGravity) | |
#resize_and_pad(w, h, :transparent, ::Magick::CenterGravity) | |
#resize_to_limit(w, h) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment