Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove attributes "height" and "width" of the image tag

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 ?

like image 250
alienlebarge Avatar asked Jun 13 '12 11:06

alienlebarge


People also ask

How do I remove the width and height of an image in Wordpress?

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 ….

Which attribute specify the width and height of an image?

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.

How do you change the width and height of an image tag?

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.

Which tag is having width and height attributes?

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.


1 Answers

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; }

like image 194
Christian Michael Avatar answered Sep 28 '22 05:09

Christian Michael