Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/10/2011, 10:34
Avatar de saymon
saymon
 
Fecha de Ingreso: septiembre-2003
Ubicación: Panama
Mensajes: 318
Antigüedad: 20 años, 8 meses
Puntos: 0
Respuesta: porque la funcion solamente es jecutada una sola vez y no cada vez que la

Me crea un thumbnail, coloco aqui el contenido:


Código PHP:
 function createthumb($name,$filename,$new_w)
  {
          
$type 0;
          
$size getimagesize($name);
          
$mime $size['mime'];                    //get image mime type (ex. "image/jpeg" or "image/gif")
          
$system=explode("/",$mime);
          if (
preg_match("/jpg|jpeg/i",$system[sizeof($system)-1])) {$type=1$src_img=imagecreatefromjpeg($name);}
          if (
preg_match("/png/i",$system[sizeof($system)-1]))      {$type=2$src_img=imagecreatefrompng($name);}
          if (
preg_match("/gif/i",$system[sizeof($system)-1]))      {$type=3$src_img=imagecreatefromgif($name);}
          
$old_x=imageSX($src_img);
          
$old_y=imageSY($src_img);
   
          
$thumb_w=$new_w;
          
$thumb_h=($old_y*$new_w)/$old_x;
          
          
$dst_imgimagecreatetruecolor($thumb_w,$thumb_h);          //create new image "canvas"       
          
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
          if      (
$type == 3)  imagegif($dst_img,$filename); 
          else if (
$type == 2)  imagepng($dst_img,$filename); 
          else                  
imagejpeg($dst_img,$filename); 
          
imagedestroy($dst_img); 
          
imagedestroy($src_img); 
  }