
06/09/2006, 11:22
|
| | Fecha de Ingreso: junio-2003
Mensajes: 778
Antigüedad: 21 años, 9 meses Puntos: 1 | |
Crear miniatura con GD Hola a todos
Estoy intentando general una miniatura con la libreria GD con el siguiente codigo:
Código:
$dir = "images/galeria/";
function createThumb($image, $newname){
$size = getimagesize ($image);
$height = $size[1];
$width = $size[0];
if ($width > $height) {
$newwidth = 120;
$newheight = round(($height*120)/$width);
} else {
$newheight = 120;
$newwidth = round(($width*120)/$height);
}
$src = imagecreatefromjpeg($image);
$im = imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($im,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($im, $newname,50);
imagedestroy($im);
}
$img = $_FILES['image']['name'];
@move_uploaded_file($_FILES["image"]["tmp_name"], $dir.$_FILES["image"]["name"]);
chmod($dir.$_FILES["image"]["name"], 0775);
createThumb($dir.$img, $dir."thumb_".$img);
y la linea $src = imagecreatefromjpeg($image); me tira el siguiente error:
Fatal error: Call to undefined function: imagecreatefromjpeg()
No se porque me pasa.
¿Podeis ayudarme? |