(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagegd — Output GD image to browser or file
   Outputs or saves the given image in GD format.
  
imageОб'єкт GdImage, що повертається однією з функцій створення зображення, такою як imagecreatetruecolor().
fileШлях або відкритий ресурс потоку (котрий автоматично закривається після повернення з цієї функції) для збереження файла. Якщо не встановлено або дорівнює null, буде виведено двійковий код зображення.
   Повертає true у разі успіху або false в разі помилки.
  
Проте, якщо libgd не може вивести зображення, ця функція повертає true.
| Версія | Опис | 
|---|---|
| 8.0.3 | fileis now nullable. | 
| 8.0.0 | Тепер imageмає бути примірником
  GdImage. Раніше очікувавсяgd-resource. | 
| 7.2.0 | imagegd() now allows to output truecolor images. Formerly, these have been implicitly converted to palette. | 
Приклад #1 Outputting a GD image
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
// Output the image
imagegd($im);
?>
Приклад #2 Saving a GD image
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
// Save the gd image
// The file format for GD images is .gd, see http://www.libgd.org/GdFileFormats
imagegd($im, 'simple.gd');
?>Зауваження:
The GD format is commonly used to allow fast loading of parts of images. Note that the GD format is only usable in GD-compatible applications.
Формати зображень GD та GD2 є пропрієтарними форматами зображень libgd. Їх слід вважати застарілими, а використовувати тільки з метою розробки та тестування.
