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_img= imagecreatetruecolor($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);
}