Quote:
Originally Posted by TwinsForMe
I don't know coding that well. I tried to add the above to my POSTBIT LEGACY template to have it applied only on the signature part but it resizes all pictures. Here is where I applied the script:
Code:
<!-- sig -->
<div>
__________________<br />
$post[signature]
<script type="text/javascript">
function resizeImages() {
if (document.images) {
var mw = 300;
var mh = 300;
for (var ii = 0; ii < document.images.length; ii++) {
var i = document.images[ii];
var iw = i.width;
var ih = i.height;
if (ih > iw && ih > mh) {
i.style.height = mh + 'px';
} else if (iw > mw) {
i.style.width = mw + 'px';
}
}
}
}
if (window.addEventListener) {
window.addEventListener('load', resizeImages, false);
} else if (window.attachEvent) {
window.attachEvent('onload', resizeImages);
} else {
window.onload = resizeImages;
}
//-->
</script>
</div>
<!-- / sig -->
How do I make it only apply to the signature?
|
Start by taking it out of the postbit... it would be inserting that over and over on showthread.php, so it's bloating your code.
And I haven't written a method for only reducing images in certain areas of the page, but you could conceivably add span tags around the signature area, and look for all images in all signature spans and then just reduce those.