I'm having this really weird problem where the image tags that I put in the views of my Rails 3.0.12 application automatically get inline style, width, and height attributes even though I haven't assigned them and overriding my CSS.
For example, if I have this in a certain view (I'm using the Paperclip gem):
<%= image_tag @campaign.advertisement.image.url(:thumb), :class => "updateable image", 'update-from' => "campaign_advertisement_attributes_image" %>
The result in the rendered view is this:
<img alt="Stock-vector-whole" class="updateable image" src="/images/advertisements/12/thumb/stock-vector-whole.jpg?1370472026" style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 0px 0px;" update-from="campaign_advertisement_attributes_image" width="0" height="0">
The result is exactly the same if I manually write the img
HTML in my view like so:
<img alt="Preview" class="updateable image" src="<%= @campaign.advertisement.image.url(:thumb) %>" update-from="campaign_advertisement_attributes_image">
These inline style attributes, since display is set to none and visibility to hidden, make the image invisible and override my stylesheets.
Does anyone know why these attributes are being set and how I can disable this behavior?
Thank you for any help.
This was pretty stupid. It turns out the Ad-block plugin in my browsers was preventing the images from being visible, not something in my application. I got the idea from this other answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With