Is there ANY way to post images in percent% and not pixels

Started by LT07, July 09, 2010, 04:40:43 AM

Previous topic - Next topic

LT07

SMF accepts <img src= but it wont let you use width="90%" and it wont accept [img width=100%]
Being forced to use pixel width means images wont scale properly.

Has anybody got a solution to set image width in percent instead of pixels using SMF 1.1.11 ?

Sigh, I have to say it always disappoints me that I cannot set boards to allow (full) use of HTML, whilst I'm aware there are security risks I simply don't care :(

Joker™

no sure , try using this tag in img

style="width:90%"

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

LT07

@Joker

Unfortunately that doesn't work either but thanks for the help.
Its just insane not being able to set the image width properly!

Joker™

i tried on  logo of default theme


', empty($settings['site_slogan']) ? '<img width="30%" id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="align_right">' . $settings['site_slogan'] . '</div>', '


and it worked prefectly.

Do one thing , apply the % as

width="Size you want%"

and do hard refresh to your browser using ctrl+f5 to see the effect(this works on firefox)


see this also
http://www.w3schools.com/tags/att_img_width.asp
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

LT07

@Joker

Unfortunately that's not what I'm trying to do, I'm trying to "post" images with 100% of available width.
Posting images as fixed pixel size is like stone age, it wont resize if your using a different skin or different screen rez, HTML does it perfectly but you can't post HTML in SMF forums.

Kindred

you are correct. BBC does not allow percentage widths.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

TehCraw

As an admin, you can use the  tag. But that won't help the rest of your forum members.


[html]
<img style="width:90%;" src="" />
[/html]
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

LT07

Quote from: ScottyBoy on July 09, 2010, 12:27:02 PM
As an admin, you can use the  tag. But that won't help the rest of your forum members.


[html]
<img style="width:90%;" src="" />
[/html]


OMG It WORKS (insert smiley of man doing cartwheels)

Why on earth isn't this mentioned in the smf help?
And if it works for admin why on earth won't such a basic (and useful) tag work for all members.
thank you thank you thank you thank you thank you thank you thank you thank you thank you  :)

Kays

HTML is for admins only. Allowing member's to use it could pose a securing risk.

A suggestion, look in Sources/Subs.php for the img tag and try adding the style="width: 90%;" there.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

LT07

@Kays

Thanks for the tip I shall look into it and if possible enable this for all members.
I have to be honest the HTML restrictions really spoil the SMF forums and width="xx%" is such an important tag I'm amazed its missing from the options. It makes the difference between image posts being beautifully formatted or putting up with hideously ugly scroll bars.

TehCraw

Just so you know, it's also possible to insert JavaScript into the HTML tag. Just one more reason to keep regular members from using it.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

Windy

You could always give everyone admin access so they can use the html tag, since that's pretty much the risk you'd be taking.
All unsolicited PM's will be ignored.  Any support requests should go in their topics.

My Mods


Image Zoom Tag
Image Quote Removal
Color Picker
Additional Polls
Simple Awards System

Mods are only updated to the latest same major version of smf on request.

TehCraw

Quote from: Windy on July 10, 2010, 02:45:00 PM
You could always give everyone admin access so they can use the html tag, since that's pretty much the risk you'd be taking.

Ain't that the truth. LOL
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

LT07

I realise tome tags can be harmful but "width=100%" ?
The best they could do is hide an image with width=0
its not like its an iframe or something

LT07

And just how is it more dangerous than the archaic method smf uses, you could still post a pixel sized image with bbc

青山 素子

If you want the ability to specify dimensions in percents, make a feature request.

Until such time as a feature is available, you can modify the bbcode definition and/or create a modification to do so.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Kindred

no one ever said that the width argument to the img tag is dangerous... BUT, by allowing users to have access to the html BBC tag, you give them free reign to post **ANY** html, including a side-track out of your site that activates a virus or other hack.

the reason that the img BBC does not include % is because either it was never thought important/needed enough to code it (and seeing as how you are the FIRST request I have seen for it, I think that opinion may be justified) or it was just overlooked...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Windy

Open Subs.php
search for 'match' => '(\d+)'
replace with 'match' => '(\d+%?)' for both the width and height parameter
All unsolicited PM's will be ignored.  Any support requests should go in their topics.

My Mods


Image Zoom Tag
Image Quote Removal
Color Picker
Additional Polls
Simple Awards System

Mods are only updated to the latest same major version of smf on request.

Advertisement: