The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Resizing only large images, not small ones.
I have an html question about resizing an image. How do you resize an image only if it's too big.
For instance if I have an image that is 500px wide and I want to down size it to 450px wide I can write something like this: Code:
<embed src="$filename" width=450> </embed> How would I write it so that only images over 450px would get resized but images under 450px would stay the same. Thanks in advanced! |
#2
|
||||
|
||||
<img src="blah" onload="if(this.width > 450) {this.width=450;}" />
|
#3
|
|||
|
|||
This works alot better, Thanks! Is there a way to write it so that I do not see the image resize when the page loads? The embed tag I used did not do that, but the image one I use does.
Code:
<div align="center"> <img src="$filename" onload="if(this.width > 450) {this.width=450;}" /> </img> </div> |
#4
|
||||
|
||||
Try this:
<img src="$filename" onload="if(this.width > 450) {this.width=450;} this.style='';" style="display:none;" /> |
#5
|
|||
|
|||
The image doesn't load at all with that code.
|
#6
|
||||
|
||||
Maybe try to put it in div with size 1x1 and overflow:hidden and when image loads resize that div to image size?
|
#7
|
|||
|
|||
I'm sorry, my coding skills aren't that good. I'm not really sure what you are describing.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|