no lo he probado, pero debería andar bien:
Código PHP:
Ver originalfunction resize($img,$mW,$mH){
// Only do something if is a image file
$fi = new finfo(FILEINFO_MIME);
$im = null;
if($type == "image/jpeg"){
}
else if($type == "image/png"){
}
else if($type == "image/bmp"){
$im = imagecreatefrombmp($img);
}
else if($type == "image/gif"){
}
else{
return null;
}
// End check if is image
$nW = $mW/$w; //How much we must resize width
$nH = $mH/$h; //How much we must resize height
$res = false; //Auxiliary variable to know if we must resize or not
//Get wich side we must resize most
$major = 0; //major var
if($nW < 1){ //If we need to resize width
$res = true; //res true
$major = $nW; // and major resize side = $nW
}
if($nH < 1){ //If we need to resize height
$res = true; //res true
if($nH > $major) $major = $nH; //if new height is less than major, then major = nH
}
if($res){ //If is neccessary to resize then...
imagecopyresized($th, $im, 0, 0, 0, 0, $w*$major, $h*$major, $w, $h); //resizing return $th; //return the thumb
}
//Else we return the im resorce
return $im;
}
$img es la dirección completa de la imagen
$mW el ancho máximo permitido
$mH el alto máximo permitido
No lo probé pero creo que debería andar bien