The Arcive of vBulletin Modifications Site. |
|
Resize large [IMG] images and link them to original Details »»
|
|||||||||||||||||||||||||||
|
Resize large [IMG] images and link them to original
Developer Last Online: Aug 2013
This mod should resize [IMG] images wider than 'max_width' and link them to their original size. Not very well tested, i'm hoping for some feedback/suggestions. I have tested in firefox/IE latest versions and it seems to work fine. Should be a pretty quick install.
INSTALL: 1) Edit /includes/class_bbcode.php around line 1879 for me. Look for: Code:
return '<img src="' . $link . '" border="0" alt="" />'; Code:
return '<img src="' . $link . '" border="0" alt="" class="img_tag" />'; Code:
<if condition="THIS_SCRIPT == 'showthread'">
<script type="text/javascript">
max_width = 700;
if(document.documentElement.outerHTML == null) {
HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var df = r.createContextualFragment(sHTML);
this.parentNode.replaceChild(df, this);
});
}
function resizeImages() {
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i];
if(img.className == "img_tag") {
if(img.width > max_width) {
var strNewHTML = '<a href="' + img.src + '" target="_blank"><img width = "' + max_width + '" src="' + img.src + '" border=0 alt="" /></a>';
img.outerHTML = strNewHTML;
}
}
}
}
if (window.addEventListener) {
window.addEventListener('load', resizeImages, false);
} else if (window.attachEvent) {
window.attachEvent('onload', resizeImages);
} else {
window.onload = resizeImages;
}
</script>
</if>
Show Your Support
|
|||||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
Demo/screenshot please.
|
|
#3
|
|||
|
|||
|
will this also resize sigs in the [IMG] tags? if so can you prevent that. thanks.
|
|
#4
|
||||
|
||||
|
Quote:
Quote:
|
|
#5
|
|||
|
|||
|
You can demo it on http://www.timesharetrap.com/forums/...tyleid=1#post7
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
because some of my members use sigs like 650x650 & it still resizes those. I just want it for pictures in threads.
|
|
#8
|
|||
|
|||
|
the other img hack wouldnt do that. I like this one alot better so hopefully you can add that as an option
|
|
#9
|
|||
|
|||
|
Updated, so the images are hidden until the browser actually resizes them. (This way you don't see the page loading with big images and then all of a sudden shrink to the right size.)
|
|
#10
|
|||
|
|||
|
Sorry teedizz i don't think i'm going to add that change. Doesn't make sense to me. No reason to resize images in the post if you aren't going to resize images in the signature as well. Whole point is to NOT break your design.
|
![]() |
|
|