solo tenes que mandar el Id de la imagen y te carga la imagen y te la achica proporcionalmente al ancho maximo que quieras...
Código PHP:
<script type="text/javascript">
function tamanopred(img){
var wp = "700"; // ancho predeterminado
var wo = document.getElementById(img).width;
var ho = document.getElementById(img).height;
// cambia los tamanos
var wres = wp*ho/wo;
var hres = wp*ho/wo;
document.getElementById(img).width=wp;
document.getElementById(img).height=hres;
}
</script>