Quote:
Originally Posted by SiMateoAko
I just replaced the code as follows and it appears to be working correctly. i'll give an explanation below for people to understand.
replace this line in your class_bbcode.php file:
Code:
return '<img src="' . $link . '" border="0" alt="" />';
With this line:
Code:
return '<img style="max-width:800px;" style= "width: expression(this.width > 800 ? 800: true);" src="' . $link . '" border="0" alt="" >';
A style attribute in firefox is "max-width," and it does everything we want it to do. "max-height" is also a style attribute.
IE, in it's infinite wisdom, decided to not include this style attribute. As a result we have to use a java expression to resize the image.
In the past there were issues if I quoted a post with an image in it, but it appears to be better now that the two style expressions are seperate.
With any luck IE will add the "max-width" and "max-height" expression for future versions of IE.
|
Awesome code! Although I have a problem...
See, the reason I needed an image resizer was mostly for my news fetch (
click here to see what I mean). I'm perfectly fine with everything, except the bbs main body is actually larger than the news fetch body, and it poses a problem with signatures. I'm ok with main body images being resized, but is there a way to keep signatures unaffected by image resizes? Or, even better, make it so that the signature images have a different resize limit?
EDIT: Nevermind, I found out how to make the image stay at it's normal size unless it stretches the page. Just replace this:
PHP Code:
return '<img style="max-width:800px;" style= "width: expression(this.width > 800 ? 800: true);" src="' . $link . '" border="0" alt="" >';
With this:
PHP Code:
return '<img style="max-width:100%;" style= "width: expression(this.width > 100% ? 100%: true);" src="' . $link . '" border="0" alt="" >';
EDIT 2: Hmmm, this code only seems to work in Firefox (dunno about Opera). Anyone have anyideas as to how I can get it to work in IE?