![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
07/12/2004, 13:14
|
| | Fecha de Ingreso: noviembre-2002 Ubicación: Barcelona - España
Mensajes: 270
Antigüedad: 22 años, 2 meses Puntos: 0 | |
$exte=".jpg";
$yafoto=($nomgos . $buffer . $exte);
$path = "../images3";
$max_size = 250000;
if (is_uploaded_file($userfile)) {
if ($userfile_size>$max_size) { echo "EL ARCHIVO ES DEMASIADO GRANDE (max. 250 KB).<br>\n"; exit; }
if (($userfile_type=="image/gif") || ($userfile_type=="image/pjpeg")) {
if (file_exists($path . $userfile_name)) { echo "EL ARCHIVO YA EXISTE.<br>\n"; exit; }
$res = copy($userfile, $path . $userfile_name);
if (!$res) {
echo "Error al subir la imágen!<br>\n"; exit; }
else
echo "La imagen se ha subido con exito<br>\n";
// echo "Nombre del Archivo: $userfile_name<br>\n";
// echo "Tamaño del Archivo: $userfile_size bytes<br>\n";
// echo "Formato del Archivo: $userfile_type<br>\n";
$img=imagecreatefromjpeg($userfile);
$bx=imagesx($img);
$by=imagesy($img);
$my=200;
$mx=intval($my*$bx/$by);
$im=imagecreatetruecolor ($mx, $my);
imagecopyresampled ($im, $img, 0, 0, 0, 0, $mx, $my, $bx, $by);
imagejpeg($im,"tu_ruta/$yafoto",75);
unlink($path . $userfile_name);
Aqui tienes un ejemplo |