Aller au contenu

Do you support the GD graphics library for PHP?

Ce contenu n’est pas encore disponible dans votre langue.

Yes. The GD graphics library is available for PHP on Ruachost hosting.

GD lets your PHP scripts create and edit images. It’s commonly used to:

  • Resize uploaded photos and create thumbnails.
  • Add watermarks or text to images.
  • Draw charts and CAPTCHA images.
  • Convert between formats such as JPEG, PNG, GIF and WebP.

WordPress, WooCommerce and many other applications use GD (or ImageMagick) to create image sizes when you upload media.

<?php
$img = imagecreatefromjpeg('photo.jpg');
$thumb = imagescale($img, 300);
imagejpeg($thumb, 'photo-thumb.jpg', 85);

If you see “Call to undefined function imagecreatefromjpeg()”:

  1. Log in to cPanel.
  2. Open Select PHP Version.
  3. Click Extensions and make sure gd is ticked.

See Changing PHP versions and settings using PHP Selector.

For more advanced image work, see Using ImageMagick.

Cette page vous a-t-elle aidé ?