=$alto_o) { $ancho=$dimension; $alto=$dimension*$alto_o/$ancho_o; } else { $alto=$dimension; $ancho=$dimension*$ancho_o/$alto_o; } $dst_img=imagecreatetruecolor($ancho,$alto); imagecopyresampled($dst_img,$src_img,0,0,0,0,$ancho,$alto,$ancho_o,$alto_o); switch ($extension[$num]) { case "jpg": ImageJPEG($dst_img,'',$calidad); break; case "JPG": ImageJPEG($dst_img,'',$calidad); break; case "gif": ImageGIF($dst_img); break; case "GIF": ImageGIF($dst_img); break; case "png": ImagePNG($dst_img); break; case "PNG": ImagePNG($dst_img); break; default: echo "No es un formato aceptado"; } ImageDestroy($src_img); Imagedestroy($dst_img); ?>