Código PHP:
   <?php
ini_set(“memory_limit”,”64M”);
 if(isset($_POST['submit']))
   {
     $new_height=100;
     $new_width=100;
     $dir=$_REQUEST[nombre_objeto];
     $allowed_types = array(
     'image/pjpeg',
     'image/gif',
     'image/png',
     'image/jpeg',
     'image/jpg',
     'application/msword',
     'application/vnd.ms-excel',
     'application/pdf',
     'application/vnd.ms-powerpoint');
     if(in_array($_FILES['thefile']['type'], $allowed_types))
     {
       copy ($_FILES['thefile']['tmp_name'], $dir."/".$_FILES['thefile']['name']) or die ("No se puede copiar");
     }
     else
     {
    }
   }
 
function tiny($d, $archivo, $type){
if ($type==0) {
    $original = imagecreatefromjpeg("$d/$archivo");
} elseif ($type==1) {
    $original = imagecreatefromgif("$d/$archivo");
} elseif ($type==2) {
    $original = imagecreatefrompng("$d/$archivo");
}
$ancho = imagesx($original);
$alto = imagesy($original);
$anchomini=80;
$altomini=($alto*$anchomini)/$ancho;
if($altomini>80){
    $altomini = 80;
    $anchomini = ($ancho*80)/$alto;
}
$thumb = imagecreatetruecolor($anchomini,$altomini);
imagecopyresampled($thumb,$original,0,0,0,0,$anchomini,$altomini,$ancho,$alto);
    if(!is_dir("$d/thumbs"))    {
          mkdir("$d/thumbs",0777);
        }
if ($type==0) {
    imagejpeg($thumb,"$d/thumbs/tn_$archivo",90);
} elseif ($type==1) {
    imagegif($thumb,"$d/thumbs/tn_$archivo",90);
}
}
 
function gallery($fotos) {
    $i = 0;
    if (is_dir($fotos)) {
       if ($handle = opendir($fotos)) {
          echo "<table class='tablaTipo02' cellspacing='1' cellpadding='0' width='100%' border='0'>";
          echo "<tr class='tablaTipo02'><td class='destacado' colspan='4'>Archivos cargados</td></tr>";
          echo "<tr>";
          while (($archivo = readdir($handle)) !== false) {
                  if(!(is_dir($archivo)OR($archivo=="thumbs"))) {
                     echo "<td align='center'>";
                         $aux=explode(".",$archivo);
                       if (trim(strtoupper($aux[1])) == 'JPG') {
                             if(!file_exists("$fotos/thumbs/tn_$archivo")){
                                tiny($fotos,$archivo,0);
                            }
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="'.$fotos.'/thumbs/tn_'.$archivo.'"/><br>'.$archivo.'</a>';
                      } elseif (trim(strtoupper($aux[1])) == 'GIF') {
                              if(!file_exists("$fotos/thumbs/tn_$archivo")){
                                tiny($fotos,$archivo,1);
                            }
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="'.$fotos.'/thumbs/tn_'.$archivo.'"/><br>'.$archivo.'</a>';
                      } elseif (trim(strtoupper($aux[1])) == 'PDF') {
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="img/pdf.jpg" /><br>'.$archivo.'</a>';
                      } elseif (trim(strtoupper($aux[1])) == 'DOC') {
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="img/word.jpg" /><br>'.$archivo.'</a>';
                      } elseif (trim(strtoupper($aux[1])) == 'PPT') {
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="img/powerpoint.jpg" /><br>'.$archivo.'</a>';
                      } elseif (trim(strtoupper($aux[1])) == 'XLS') {
                            echo '<a href="'.$fotos.'/'.$archivo.'" target="_blank"><img src="img/excel.jpg" /><br>'.$archivo.'</a>';
                      }
                      echo "</td>";
                      $i++;
                      $j=($i%4);
                      if($j==0){
                            echo  '</tr><tr>';
                      }
                }
            } // while
        echo "</tr></table>";
         }
         //closedir($fotos);
   }
}
 
    include("../encabezado.php");
    echo "<LINK rel='stylesheet' href='../v3.css'>";
    $enlaces = array('javascript:window.close()');
    $textos = array('Cerrar esta ventana');
    menu($enlaces, $textos, 1);
    $directorio = $_GET[nombre_objeto];
    if ($_GET[op]==1) {
        if (!is_dir("$directorio"))  {
              mkdir("$directorio",0777);
            }
    }
    echo "<td>";
    echo "<table>";
    echo "<tr><td class=encabezado>Listado de Anexos</td></tr></table>";
    echo "<form name='form1' method='post' action='anexos.php?op=0&nombre_objeto=".$directorio."' enctype='multipart/form-data'>";
    echo "<table class='tablaTipo02' cellspacing='1' cellpadding='0' width='100%' border='0'><tr>";
    echo "<td class='destacado'><div align='right'>Seleccione archivo a anexar:</div></td>";
    echo "<td class='informacion'><p><input type='file' name='thefile'><input type='submit' name='submit' value='Cargar'></p></td>";
    echo "</tr>";
    echo "</table>";
       echo "</form>";
    gallery($directorio);
    echo "</td>";
    include("../pie.php");
?>    por favor me podrian aportar algunas ideas u metodos para crear las miniaturas de archivos de dimensiones mayores de 2200x1400? o sera que mi codigo tiene algun error que no puedo visualizar?
Gracias de antemano.
 

