Using NETPBM to generate thumbnails (my script uses GD)

hknight

Joined: 2003-08-21
Posts: 7
Posted: Thu, 2004-01-29 00:55

I use the following code to dynamically create thumbnails using GD. The thumbnails are very poor in quality, and GIFs are not supported. So I would like to use NETPBM instead of GD.

What can I change to use NETPBM instead of GD?

From thumb.php:

<? 
header("Content-type: image/jpeg"); 
$imagem = $_GET['img']; 
$max_x = "100"; 
$max_y = "80"; 

$im = imagecreatefromjpeg($imagem); 

//rescale proportionaly 
if ($max_x != 0 && $max_y != 0) { 
$x = imagesx($im); 
$y = imagesy($im); 

if ($x > $max_x) { 
$y = (int)floor($y * ($max_x / $x)); 
$x = $max_x; 
} 

if ($y > $max_y) { 
$x = (int)floor($x * ($max_y / $y)); 
$y = $max_y; 
} 
} 

$img_dest = imagecreate($x,$y); 
imagecopyresized($img_dest,$im,0,0,0,0,$x,$y,imagesx($im),imagesy($im)); 
imagejpeg($img_dest); 
?>