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 ?
Use jquery
set an id to your image object:
here is alternative javascript code:
FYI: There is no way to remove this with typoscript. The
width
andheight
attribute is hardcoded insysext/cms/tslib/class.tslib_content.php
functioncImage
. (Typo3 4.7)This will be possible with TYPO3 6.2 LTS. Checkout http://forge.typo3.org/issues/49723.
To remove the effects of fixed width and/or height attributes without actually removing these attributes you can set them back to "auto" in your CSS definitions:
I suggest to do that only for the img tags where you really need the pictures to be fluid. This could be done by adding an id or class to the img tags or any surrounding tag.
E.g. if your fluid images are located in a wrapper div with class "fluid_pics" you could use:
Often you will only need to set the height back to auto, as the width is already overwritten to be 100% by your framework (e.g. Twitter Bootstrap).
There is a solution for old TYPO3s with TYPOSCRIPT:
Use this stdWrap-TS where your image is rendered.
Call an image tag in document.ready function.