document.observe("dom:loaded", function() {
    $$('img').each(function(imageElement) {
        imgSrc = imageElement.src;
        uploadIndex = imageElement.src.indexOf("/upload/") 
        if (uploadIndex != -1) {
            base = imgSrc.substring(0,uploadIndex+8);
            fileName = imgSrc.substring(uploadIndex+8)
            imageElement.src = base + imageElement.width+"x"+imageElement.height+"/"+fileName
        }
    })
});