Server rental store

GD

# GD Configuration for MediaWiki 1.40

This article details the configuration of the GD library for use with MediaWiki 1.40. GD (Graphics Draw) is a library used for dynamically creating and manipulating images. It’s crucial for tasks like thumbnail generation, CAPTCHAs, and image manipulation within the wiki. This guide will walk you through installation, configuration, and troubleshooting.

What is GD?

GD is a library that provides functions for creating and manipulating images. MediaWiki leverages GD for several features, primarily related to image handling. Without a properly configured GD library, these features will not function correctly. Common issues include failure to generate thumbnails, CAPTCHAs not displaying, and image uploads being problematic. See Manual:Configuration for general configuration information.

Installation

The installation process varies depending on your operating system. Below are instructions for common systems. Remember to restart your web server (usually Apache or Nginx) after installing. Consult your operating system's documentation for more detailed instructions. Refer to the Extension:GD page for more information about the extension.

Debian/Ubuntu

Use the apt package manager:

```bash sudo apt-get update sudo apt-get install php-gd sudo systemctl restart apache2 # or nginx, depending on your web server ```

CentOS/RHEL

Use the yum package manager:

```bash sudo yum install php-gd sudo systemctl restart httpd # or nginx, depending on your web server ```

Windows

GD is usually enabled by default in PHP installations for Windows. If not, edit your `php.ini` file and uncomment the line `extension=gd`. Then, restart your web server. See Manual:How to configure PHP for more details.

Configuration

Once GD is installed, verify it is enabled in your PHP configuration.

1. Create a PHP file (e.g., `phpinfo.php`) with the following content:

```php ```

2. Access this file through your web browser.

3. Search for "GD" within the output. If GD is correctly installed, you will see a section detailing its version and configuration.

If GD is not listed, you need to ensure the `extension=gd` line is uncommented in your `php.ini` file and that the extension directory is correctly specified. Consider checking the PHP configuration settings.

Important GD Settings

Several GD settings can be adjusted to optimize performance and image quality. These settings are typically found in your `php.ini` file.

Setting Description Default Value Recommended Value
`gd.jpeg_quality` Quality of JPEG images (0-100) 75 85-95 (for better quality)
`gd.png_quality` Compression level for PNG images (0-9) 0 3-5 (balance between size and quality)
`gd.gif_quality` Quality of GIF images (0-100) 0 100 (for best quality, though GIF is generally limited)

You may need to adjust these values depending on your specific needs and server resources. Consider the trade-off between image quality and file size. See Help:Images for information about supported image formats.

Troubleshooting

If you encounter issues with GD, here are some common troubleshooting steps:

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️