11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/facebook_cover_resize/view_helpers.rb', line 11
def tag_generator(args)
dims = FacebookCoverResize.compute(original: args[:original], offsets: args[:offsets], width: args[:width], ratio: args[:ratio])
width = args[:width].to_i
height = (width / args[:ratio]).ceil
source = args[:source]
content_tag(:div,
image_tag(source,
style: "position: absolute !important;top: #{dims[0]}px !important;left: #{dims[1]}px !important;width: #{dims[2]}px !important;height:#{dims[3]}px !important; margin: 0 !important"
),
style: "width: #{width}px !important; height: #{height}px !important; overflow: hidden !important;position: relative !important; padding:0 !important"
)
end
|