I've installed IM on my PC along with MiniMagick to resize images in a Rails application. I am trying to create thumbnails for every image that the user uploads in its own gallery.
Here's the code:
Code: Select all
# Saving the image file
File.open(path, "wb") { |f| f.write(upload['datafile'].read) } # write the file
# Creating the thumbnail
image = MiniMagick::Image.from_file(RAILS_ROOT+'/'+directory+name)
image.resize "100x100"
image.write(RAILS_ROOT+'/'+directory+"output.jpg")