estoy usando este codigo y funciona perfecto...
$original = imagecreatefromjpeg($nombre);
$thumb = imagecreatetruecolor(100, 100);
imagecopyresampled($thumb, $original, 0, 0, 0, 0, 100, 100, $ancho, $alto);
imagejpeg($thumb,"thumb".$codigo.".jpg",90);
tomando el ejemplo que me enviaron, me muestra errores en todas las lineas.
$datos = getimagesize($camino.$nombre);
$ratio = ($datos[1] / $altura); // error
$anchura = round($datos[0] / $ratio); // error
$thumb = imagecreatetruecolor($anchura,$altura); // error
imagecopyresampled ($thumb, $original, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]); // error
imagejpeg($thumb,"thumb".$codigo.".jpg",90); // error
los errores..
Warning: Division by zero in /home/tgdannar/public_html/clientes/papaya/pictures/upload2.php on line 457
Warning: Division by zero in /home/tgdannar/public_html/clientes/papaya/pictures/upload2.php on line 458
Warning: imagecreatetruecolor(): Invalid image dimensions in /home/tgdannar/public_html/clientes/papaya/pictures/upload2.php on line 459
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/tgdannar/public_html/clientes/papaya/pictures/upload2.php on line 460
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/tgdannar/public_html/clientes/papaya/pictures/upload2.php on line 461