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.

Fixed Width for Resized Images?

edited March 2007 in Vanilla 1.0 Help
Is there any way to make the resized images in Filebrowser a fixed width. Some of the images on my website are too big to fit into the site layout, yet they are not resized. I would like to make it so that any image with a width larger than 500px is resized to fit.

Comments

  • a javascript like this may be : <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>
This discussion has been closed.