If you have already compiled php without jpeg support and decide you want it , then before you compile again you might need to run "make clean" first.
Installation
Pour activer le support de GD, vous devez compiler PHP avec l'option --with-gd[=DIR], où DIR est le dossier d'installation de GD. Il est recommandé d'utiliser la version de GD qui est distribuée avec PHP, en utilisant simplement l'option --with-gd. La bibliothèque GD requiert libpng et libjpeg pour compiler.
Sous Windows, vous devez inclure la bibliothèque php_gd2.dll comme extension dans le fichier php.ini. La bibliothèque php_gd.dll a été supprimée de PHP 4.3.2. Notez aussi que les fonctions conseillées truecolor, comme imagecreatetruecolor(), requièrent GD2.
Augmentez les possibilités des GD de gérer d'autres formats d'images en spécifiant les options --with-XXXX de compilation suivantes :
| Format d'image | Option de compilation |
|---|---|
| jpeg-6b | Pour activer le support de la bibliothèque JPEG-6b, ajouter l'option --with-jpeg-dir=DIR. |
| png | Pour activer le support de la bibliothèque PNG, ajouter l'option --with-png-dir=DIR. Notez que libpng requiert la bibliothèque zlib et, donc, il vous faudra ajouter aussi --with-zlib-dir[=DIR] dans votre ligne de compilation. |
| xpm | Pour activer le support de la bibliothèque XPM, ajoutez l'option --with-xpm-dir=DIR. Si le script de compilation n'est pas capable de trouver les bibliothèques nécessaires, il vous faudra ajouter le chemin vers les bibliothèques X11. |
Note: Lorsque vous compilez PHP avec libpng, vous devez utiliser la même version que celle liée à la bibliothèque GD.
Augmentez les possibilités de GD pour qu'elle manipule différents types de polices de caractères en ajoutant les options --with-XXXX de compilation suivantes :
| Bibliothèque | Option de configuration |
|---|---|
| FreeType 1.x | Pour activer le support de FreeType 1.x, ajoutez l'option --with-ttf[=DIR]. |
| FreeType 2 | Pour activer le support de FreeType 2, ajoutez l'option --with-freetype-dir=DIR. |
| T1lib | Pour activer le support de T1lib (Postscript Type 1 fonts), ajoutez l'option --with-t1lib[=DIR]. |
| Chaînes TrueType | Pour activer le support des chaînes de caractères TrueType, ajoutez l'option --enable-gd-native-ttf. |
Installation
27-Jan-2009 12:07
06-Jan-2009 07:08
For Redhat Linux 64 bit machine:
--with-libdir=lib64 --with-gd --with-jpeg-dir --with-png-dir
30-Oct-2008 03:45
It should be noted that it might be pretty easy to install gd without the need to recompile php, when using debian:
apt-get install php5-gd
21-Aug-2008 04:36
On my system,I had to ensure I had not only libpng and libjpeg, but also the libpng-devel and libjpeg-devel packages installed.
17-Jul-2008 09:44
Everytime I try to install the gd-lib as a dynamic extension, I run into the same problem: It wont work.
I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/pkg/lib/php/20040412/gd.so' - dlopen(/usr/pkg/lib/php/20040412/gd.so, 9): Symbol not found: __cg_jpeg_resync_to_restart\n Referenced from: /System/Library/Frameworks/ApplicationServices. framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO\n Expected in: /usr/pkg/lib/libjpeg.62.dylib\n in Unknown on line 0
I use pkgsrc for software package managment on my mac, as may be apparent from the paths.
The solution is, to edit the file /usr/pkg/sbin/envvars and remove or comment the DYLD_LIBRARY_PATH because it is causing the error...
18-Apr-2008 04:40
jpeg [jpg] file processing doesn't work unless you build php with '--with-jpeg-dir=<path to jpeg library>'.
It still doesn't work unless <path to jpeg library> points to the directory holding the directory holding the library unless libjpeg.<whatever> is in either /usr/lib or /usr/local/lib. For instance, on a mac with libjpeg.a installed via mac ports, you need '/opt/local' rather than '/opt/local/lib'
