Skip to content

Instantly share code, notes, and snippets.

@NaiyaShah-BTC
Created August 13, 2018 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NaiyaShah-BTC/6841774aff39fc5d3f81a0cd6428e7cc to your computer and use it in GitHub Desktop.
Save NaiyaShah-BTC/6841774aff39fc5d3f81a0cd6428e7cc to your computer and use it in GitHub Desktop.
SIZES_ARR = [[167, 200, 'S'], [325, 390, 'M'], [625, 750, 'L']]
SIZES_ARR.each do |size_data|
resize_image(cropped_img, size_data.first, size_data.second, size_data.last)
end
def resize_image(image, width, height, size)
image.resize_to_fill(width, height).write(Rails.public_path.join("#{size}_#{self.img_file_name}"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment