Page 1 of 1
[Resolved] supressing width and height attributes in image tag
Posted: Mon Jul 28, 2008 1:16 am
by kneehigh
Currently the smarty {image} tag inserts the width and height of the image so when a css width is applied the image is resized nicely across its width , but is left at its real height so the image is distorted - this in turn buggers up the rest of the table as I am giving it a rowspan of 4
I do not wish to go down the route of creating thumbnails , but want to use css to resize the image to a fixed width in a table column (yes I know its slow but there is only one image on the page).
Is there any way to have the generation of the width and height attributes suppressed ?
Re: supressing width and height attributes in image tag
Posted: Mon Jul 28, 2008 2:08 am
by kermit
why not just specify the exact dimensions, height and width, you want the image scaled to in the tag? if you specify height and width (by pixels, just like an tag) in the tag, those values should override the actual file's dimensions.
alternatively, you can modify ./plugins/function.image.php, starting around line 31 (first and last lines are additions, rest is to show where to put them):
Code: Select all
if (!isset($params['nosize'])) {
if( !empty($params['width'] ) ) {
$text .= ' width="'.$params['width'].'"';
} elseif ($size[0] > 0) {
$text .= ' width="'.$size[0].'"';
}
if( !empty($params['height'] ) ) {
$text .= ' height="'.$params['height'].'"';
} elseif ($size[1] > 0) {
$text .= ' height="'.$size[1].'"';
}
}
then when you want to suppress output of height and width completely, set
nosize='yes' in the tag. (note the above only checks to see if nosize is set, not what its value is.. if it is set, height and width are omitted, even if you set nosize='false' or nosize='no'. nosize also takes precedence over specified height and/or width params, if present)
Re: supressing width and height attributes in image tag
Posted: Tue Jul 29, 2008 11:37 pm
by kneehigh
Kermit many thanks - just didn't know where to find the code to be modified