bueno les paso el codigo
Código :
<?PHP if($_GET['tipo']=="subir-img"){ include("config.php") ; $inpt="flog_f"; $ruta=$_FILES[$inpt]['name']; $max=500; if(empty($max)) $max = 150; // Esta parte me la dijo omega ya q no se me ocurrio poner un defaultif(eregi('gif$',$ruta,$ext) || eregi('jpg$',$ruta,$ext) || eregi('png$',$ruta,$ext)) { if($ext[0] == "jpg") $ext[0] = "jpeg"; $funcion = 'imagecreatefrom'.$ext[0]; $fuente = @$funcion($ruta); $imgAncho = imagesx($fuente); $imgAlto = imagesy($fuente); if($imgAncho>$imgAlto) { $ancho = $max; $alto = intval(($imgAlto/$imgAncho)*$max); } else { $ancho = intval(($imgAncho/$imgAlto)*$max); $alto = $max; } $nnew=date("d"."m"."y"."h"."i"."s").".jpg"; $imagen = imagecreatetruecolor($ancho,$alto); imagecopyresized($imagen,$fuente,0,0,0,0,$ancho,$alto,$imgAncho,$imgAlto); imagejpeg($imagen,"upload/".$nnew); $thumb=imagecreatetruecolor(120,138); imagecopyresampled($thumb,$imagen,0,0,0,0,120,130,$ancho,$alto); imagejpeg($thumb,"upload/chica/chica-".$nnew); $numero2 = count($_POST); $tags2 = array_keys($_POST); $valores2 = array_values($_POST); for($i=0;$i<$numero2;$i++){ $$tags2[$i]=$valores2[$i]; } mysql_query("INSERT INTO ggaleria (idseccion,img,fecha,chica) VALUES ('$seccion','upload/".$nnew."','$fecha','upload/chica/chica-".$nnew."')") ; echo"SUBIDA"; } else { header("Content-type: image/gif"); $imagen = imagecreate(400,100); $bg = imagecolorallocate($imagen,255,255,255); $color = imagecolorallocate($imagen,0,0,0); imagestring($imagen,"3",5,0,"Error: No se puede generar la imagen.",$color); imagestring($imagen,"3",5,15," Verifique la ruta o el formato",$color); imagestring($imagen,"3",5,30," Formatos aceptables: Gif, Jpg y Png",$color); imagegif($imagen); imagedestroy($imagen); } } ?> <div id=""></div> <div id=""> <form action="upload.php?tipo=subir-img" method="post" enctype="multipart/form-data" name="flog_form"> <br />Subir una imagen a la galeria.<br /><br /> Seccion * <input type="text" name="seccion" maxlength="100" size="20"><br /><br /> Archivo *<input name="flog_f" type="file" id="flog_f" size="9"><br /><br /><br /> <input name="button" type="submit" value="Subir" class="BOTON"> </form> </div>
gracias y saludos