Ciao a tutti, ho un problema con la funziona di ridimensionamento immagini. Con php 4.2.2 e le GD 1.6.2 questa funzione funzionava correttamente... adesso mi crea l'immagine con le nuove dimensioni ma monocromatica...non capisco dove è il problema

codice:
function riduci_foto($campo,$dir,$larghezza,$nome){
	$dest = "/directory/di/destinazione";
	$img = imagecreatefromjpeg($_FILES[$campo]['tmp_name']);
    	$img_width = imagesx($img);
    	$img_height = imagesy($img);
	$thumb_width = $larghezza;
	$thumb_height = ($img_width != $thumb_width) ? floor($thumb_width * $img_height / $img_width) : $img_height;
	$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
	imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $img_width, $img_height);
	imagejpeg($thumb, $dest."/$nome", 100);
	imagedestroy($img);
	imagedestroy($thumb);
}