Version 1 - Replace in modules/netpbm/classes/NetPbmToolkit.class:
case 'thumbnail':
            /* Don't enlarge images for a thumbnail */
            $preserveMetaData = false;
            if ($width <= $parameters[0] && $height <= $parameters[0]) {
                break;
            } else {
                /* fall through to scale */
            }with:
case 'thumbnail':
            /* Create the thumbnail with fixed width */
            $preserveMetaData = false;
            $aspect = $height / $width;
            $targetWidth = $parameters[0];
            $ysize = round($targetWidth * $aspect);
            $xsize = $parameters[0];
            $transform[] = array($this->_pnmCmd('pnmscale'),
                '--quiet', '-xsize', $xsize, '-ysize', $ysize);
            break;Version 2 - replace in modules/netpbm/classes/NetPbmToolkit.class:
case 'thumbnail':
            /* Don't enlarge images for a thumbnail */
            $preserveMetaData = false;
            if ($width <= $parameters[0] && $height <= $parameters[0]) {
                break;
            } else {
                /* fall through to scale */
            }with:
case 'thumbnail':
            /* Create the thumbnail with fixed width */
            $preserveMetaData = false;
            if (isset($width)) {
                list ($width, $height) = GalleryUtilities::scaleThumbnailToFit(
                   $width, $height, $parameters[0]);
            }
            $transform[] = array($this->_pnmCmd('pnmscale'),
                 '--quiet', '-xsize', $width, '-ysize', $height);
            break;and add to modules/core/classes/GalleryUtilities.class:
function scaleThumbnailToFit($width, $height, $targetWidth, $targetHeight=null) {
 	$aspect = $height / $width;
 	$width = $targetWidth;
 	$height = round($targetWidth * $aspect);
 	return array($width, $height);
     }