Resize Scale an image proportionally in javascript

From Code Trash
Jump to: navigation, search
function processspecial()
{
	var so = document.getElementById('weektopcharity')
	var mino=null
//75,125
	if(so)
	{
		so = so.getElementsByTagName('img');
		for(var i=0;i<so.length;i++)
		{
			if(so[i].width>125)
			{
				so[i].style.width = '125px';
				so[i].width = 125
 
				if(so[i].height>70)
				{
					mino = so[i].height - 70
					so[i].style.width = so[i].width - mino + 'px'
				}
			}
			else
			{
				so[i].style.height = '70px';
				so[i].height = 70;
				if(so[i].width>125)
				{
					mino = so[i].width - 125
					so[i].style.height = so[i].height - mino + 'px'
				}
			}
		}
	}
}