Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Possible to automatically resize post images?
Is it possible? Is there a snippet of CSS code that can be added to the global.css that will automatically resize user posted images? That's one of my major pet peeves is browsing through a forum and seeing someones huge image spanning past the border of the forem.
0
This discussion has been closed.
Comments
.CommentBody img { height: 100px; width: 100px; }
Now what you also want to do, requires an extension or modifying the code, is to add an anchor around images that will link to the full size image.
See an example here
But then I guess I would have to deal with the original if people wanted to view it.
<script language="Javascript" type="text/javascript"> //<![CDATA[ var BodyLoaded = 0; if (document.all && !document.getElementById) { document.getElementById = function(id) { return document.all[id]; } } function copy(inElement) { if (inElement.createTextRange) { var range = inElement.createTextRange(); if (range && BodyLoaded==1) range.execCommand('Copy'); } else { var flashcopier = 'flashcopier'; if(!document.getElementById(flashcopier)) { var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); } document.getElementById(flashcopier).innerHTML = ''; var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+escape(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'; document.getElementById(flashcopier).innerHTML = divinfo; } } function writeImage(imageName, imageWidth, imageHeight, imageID) { var windowWidth = getWindowWidth(); if (windowWidth < imageWidth) { var newWidth = windowWidth - 40; var newHeight = Math.round((newWidth*imageHeight)/(imageWidth+40)); document.write('<span id="sm'+imageID+'">' +'<div class="Notice">Note: this image has been shrunk to fit on your screen. <a href="Javascript:resizeImage('+imageID+');">Click here to view the image at actual size.</a></div>' +'<img src="'+imageName+'" height="'+newHeight+'" width="'+newWidth+'" />' +'</span>' +'<span id="lg'+imageID+'" style="display: none;">' +'<div class="Notice">Note: this image does not fit on your screen. <a href="Javascript:resizeImage('+imageID+');">Click here to fit the image to your screen.</a></div>' +'<img src="'+imageName+'" height="'+imageHeight+'" width="'+imageWidth+'" />' +'</span>'); } else { document.write('<img src="'+imageName+'" height="'+imageHeight+'" width="'+imageWidth+'" />'); } } function getWindowWidth() { var myWidth = 0; if( typeof( window.innerWidth ) == 'number' ) { myWidth = window.innerWidth - 20; } else if (document.documentElement && document.documentElement.clientWidth) { myWidth = document.documentElement.clientWidth; } else if (document.body && document.body.clientWidth) { myWidth = document.body.clientWidth; } else { myWidth = screen.width; } return myWidth; } function resizeImage(imageID, link) { var lg = document.getElementById('lg'+imageID); var sm = document.getElementById('sm'+imageID); if (lg && sm) { switchVisibility(lg); switchVisibility(sm); } } function switchVisibility(object) { if (object.style.display == 'none') { object.style.display = 'block'; } else { object.style.display = 'none'; } } //]]> </script>
$Head->AddScript('imageresizer.js');