|    
			
				12/05/2009, 03:43
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: marzo-2008 
						Mensajes: 72
					 Antigüedad: 17 años, 7 meses Puntos: 0 |  | 
  |  Respuesta: Aceptar imagenes segun su dimension  
  Este es el codigo que tengo para subir la imagen:
 $ruta = $_FILES['imagen']['name'];
 $rutatemp = $_FILES['imagen']['tmp_name'];
 $ruta= str_replace(" ", "", $ruta);
 $tipo= $_FILES['imagen']['type'];
 $tamano = $_FILES['imagen']['size'];
 if(!((strpos($tipo, "gif") || strpos($tipo, "jpeg")) && ($tamano < 100000) )) {
 echo 'La extensión o el tamaño de los archivos no es correcta';
 return false;
 }
 else
 {
 move_uploaded_file($rutatemp,"upload/".$ruta);
 }
 
 
 
 Y lo que tengo que hacer es incluirla en esta otra,verdad??
 
 
 function crearThumb( $fuente, $destino, $dim=120, $propor=false, $forzar=false ) {
 $tipo_imagen = explode( ".", $fuente );
 $sizeof = count( $tipo_imagen ) - 1;
 $ext = strtolower( $tipo_imagen[$sizeof] );
 if ( $ext == "gif" ) {
 $fuenteimg = @imagecreatefromgif( $fuente );
 }
 elseif ( $ext == "png" ) {
 $fuenteimg = @imagecreatefrompng( $fuente );
 }
 else {
 $fuenteimg = @imagecreatefromjpeg( $fuente );
 }
 list( $ancho, $alto, $tipo, $atr ) = getimagesize( $fuente );
 if ( $ancho > $dim || $alto > $dim || $forzar ) {
 if ( $propor ) {
 if ( $ancho > $alto ) {
 $nAncho = $dim;
 $nAlto = $dim/( $ancho/$alto );
 } else {
 $nAlto = $dim;
 $nAncho = $dim/( $alto/$ancho );
 }
 } else {
 $nAncho = $dim;
 $nAlto = $dim;
 }
 $thumb = imagecreatetruecolor( $nAncho, $nAlto );
 imagecopyresampled( $thumb, $fuenteimg, 0, 0, 0, 0, $nAncho, $nAlto, $ancho, $alto );
 $calidad = 100;
 if ( $ext == "gif" ) {
 imagegif( $thumb, $destino, $calidad);
 }
 elseif ( $ext == "png" ) {
 imagepng( $thumb, $destino, $calidad);
 }
 else {
 imagejpeg( $thumb, $destino, $calidad);
 }
 }
 }
     |