Sha256: 75cb6c8e3087f23b7281e53160400782740ba52b548e5d815feb5a0a9454d9d1
Contents?: true
Size: 1.71 KB
Versions: 20
Compression:
Stored size: 1.71 KB
Contents
<%= # Set parameter for size, small|medium|large if you like size ||= "medium" fix_size ||= true # small med and x-large correspond roughly to amazon sm, med and lg. # large corresponds roughly to google medium. Just one dimension to # prevent disproportionate scaling. We use CSS so we can set maximums # in BOTH dimensions but let aspect ratio remain the same. We put it # inline so HTML Snippet API clients get images constrained to reasonable # sizes without extra CSS. IE6 won't do max-height/max-width, sorry IE6, no # way to accomodate you (trying to put a width and a max-width triggers # weird IE8 bugs!). Best we can do. # # generally the 'max-height' is our operative maximum for ordinary ratios, # but we let the width be more than the height for weird ratio'd covers # that are wider than square. dimensions_style = { "small" => "max-height: 80px; max-width: 100px; box-sizing: content-box;", "medium" => "max-height: 160px; max-width: 200px; box-sizing: content-box;", "large" => "max-height: 200px; max-width: 240px; box-sizing: content-box;", "extra-large" => "max-height: 475px; max-width: 570px; box-sizing: content-box;" } img_st = cover_image_response(size) if img_st img_data = img_st.view_data img_params = {'src'=>img_data[:url], 'class'=>'cover_image', 'alt'=>h(img_data[:display_text])} # If we're in https mode, and the original url is http, use # Umlaut proxy to avoid browser security warning. if (request.protocol != img_params['src'][0..6]) img_params['src'] = url_for(:controller => "resource", :action => "proxy", :id => img_st.id ) end img_params.merge!( "style" => dimensions_style[size]) if fix_size tag('img', img_params ) end %>
Version data entries
20 entries across 20 versions & 1 rubygems