Tengo un formulario con
Código:
Luego tengo este script para subir y crear thumbnails:<FORM name=globe method=POST ACTION="upload.php" enctype=multipart/form-data> <input type=file name=img1 size=30><br> <input type=file name=img2 size=30><br> <input type=file name=img3 size=30><br> <input type=file name=img4 size=30><br> <INPUT TYPE="submit" NAME="accion" VALUE="Enviar">
Código PHP:
//Subir primera imagen
srand (time());
$tempo = rand (100000000, 999999999);
//Chequea el tamano de la imagen
if (($sizelim == "yes") && ($img1_size > $size)) {
$log1 .= "Imagen 1 es muy grande<br>";
} else {
//borra espacios en blanco y lo 'minisculiza'
$img1_name = strtolower($img1_name);
$img1_name = ereg_replace( " ", "", $img1_name);
//Revisa si el archivo es una imagen
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
@copy($img1, "$temporal/$img1_name") or $log .= "No se pudo copiar la imagen 1 al servidor, asegúrate que es una imagen .JPG<br>";
rename ("$temporal/$img1_name", "$abpath/$tempo$img1_name");
if (file_exists("$abpath/$tempo$img1_name")) {
$first=ImageCreateFromJPEG("$abpath/$tempo$img1_name") or die("No pudo abrir la imagen");
// Tamaño del Thumbanil (de la imagen a generar ..)
$picsize = 150;
// Se obtienen los datos del ancho y alto de la imagen.
$new_w = imagesx($first);
$new_h = imagesy($first);
// Se calcula la relación alto/ancho
$aspect_ratio = $new_h / $new_w;
// Se ajusta al nuevo tamaño
$new_w = $picsize;
$new_h = abs($new_w * $aspect_ratio);
$second=ImageCreateTrueColor($new_w,$new_h) or die("No pudo crear la imagen");
ImageCopyResized($second,$first,0,0,0,0,$new_w,$new_h,imagesx($first),imagesy($first)) or die("coudln't resize image");
ImageJPEG($second,"thumb/$tempo$img1_name") or die("couldn't save image");
//crea el thumbnail (usando libreria GD de PHP)
$log1 .= "ok";
}
} else {
$log1 .= "Campo Vacío";
$tempo = "";
}
}
No se como =(
Gracias de antemano.