Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-04-19 08:39:43

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

How to remove size from IMG tag

the IMG tag bring automaticaly height and width with any images : <img src=“x” width=“x” height=“x” />
I want just image tag without width and height: <img src=“x” />

Offline

#2 2013-04-19 08:48:09

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,795
Website GitHub

Re: How to remove size from IMG tag

If you mean from the txp:image tag then you can use attributes width="0" height="0" to turn them off.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2013-04-19 09:09:31

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: How to remove size from IMG tag

Yes that’s work fine, thank you
But Also i have installed and using the plugin: wet_article_thumb
i did width=“0” height=“0” , that’s not working !

Offline

#4 2013-04-19 09:40:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,795
Website GitHub

Re: How to remove size from IMG tag

I don’t think wet_article_thumb honours the width and height attributes as it pre-dates their inclusion in the core tags txp:image / txp:thumbnail. I may be wrong, but that’s probably the issue.

Last edited by Bloke (2013-04-19 09:41:33)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2013-04-19 18:00:05

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: How to remove size from IMG tag

Regardless of the plugin ways or the native ways to display images, maybe using class attributes would be a good choice.

CSS classes like these for instance:

img.small {width: x;}
img.medium  {width: x;}
img.large  {width: x;}

txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#6 2013-04-20 00:31:06

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How to remove size from IMG tag

The best practice is always use width and height with the img tag. It helps the browser out, and your visitor. The image will not cause any content shifting while its loaded, for one.

If you want to remove the proportion attributes to have ‘responsive’ images that scale, you can use CSS and override the attributes. The attributes are there for browsers and not for presentation. Basically setting width and height to auto nullifies the attributes’ affect.

Offline

Board footer

Powered by FluxBB