• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Image Quality on Resize?


Well-known member
If I set max dimensions for an image upload, any image that exceeds this is automatically resized. Is there somewhere to set the image quality of the resized image, or is it hard coded?

If it's hard coded, what is it? - does anyone know? :)

Jake Bunce

XenForo moderator
Staff member
Assuming you are using the GD library:


You probably can't change the default value in the function signature because of the abstract. But this should work:

	 * Outputs the image.
	 * @see XenForo_Image_Abstract::output()
	public function output($outputType, $outputFile = null, $quality = 85)
		if ($quality == 85)
			$quality = 90;

		switch ($outputType)
			case IMAGETYPE_GIF: $success = imagegif($this->_image, $outputFile); break;
			case IMAGETYPE_JPEG: $success = imagejpeg($this->_image, $outputFile, $quality); break;
				// "quality" seems to be misleading, always force 9
				$success = imagepng($this->_image, $outputFile, 9, PNG_ALL_FILTERS);

				throw new XenForo_Exception('Invalid output type given. Expects IMAGETYPE_XXX constant.');

		return $success;