Module: ImagesHelper
- Defined in:
- app/helpers/images_helper.rb
Instance Method Summary collapse
Instance Method Details
#image_width_for_height(filename, target_height) ⇒ Object
2 3 4 5 6 |
# File 'app/helpers/images_helper.rb', line 2 def image_width_for_height(filename, target_height) source_width, source_height = FastImage.size("#{Rails.root}/app/assets/images/#{filename}") ratio = source_width.to_f / source_height.to_f (target_height * ratio).to_i end |