In order to create a responsive website with Typo3 and Twitter Bootstrap, I would like to remove the height and width attributs of images
Here's how images are generated in Frontend via content element of type text & image and image
<img src="typo3temp/pics/a625b79f89.jpg" width="300" height="226" alt="blabla" />
I would like to remove the dimension attributes and get this:
<img src="typo3temp/pics/a625b79f89.jpg" alt="blaba" />
Can anyone help me ?
function remove_width_attribute($html) { $html = preg_replace('/(width|height)="\d*"\s/', "", $html); return $html; } add_filter('post_thumbnail_html', 'remove_width_attribute', 10); add_filter('image_send_to_editor', 'remove_width_attribute', 10); Actually in the Editor I don't see width and height ….
The width attribute specifies the width of an image, in pixels. Tip: Always specify both the height and width attributes for images. If height and width are set, the space required for the image is reserved when the page is loaded.
The height and width of an image can be set using height and width attribute. The height and width can be set in terms of pixels. The <img> height attribute is used to set the height of the image in pixels. The <img> width attribute is used to set the width of the image in pixels.
The height and width attribute in HTML is used to specify the height and width of the element. The values are set in px i.e. pixels. To add an image in an HTML page, <img> tag is used. With that, we need to use the attributes height and width to set the height and width of the image in pixels.
It's not possible to remove the height or width image attributes with typoscript.
But you could override it with CSS in order to create a responsive website.
img {
height:100% !important;
width:100% !important;
}
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