How to enable GD library support in PHP

Source: Internet
Author: User
Tags install php ini int size

 

Enable GD library support for PHP in Windows

Find php. ini, open the content, and find:

; Extension = php_gd2.dll

Remove the semicolon ";" at the beginning and save it. If there is no semicolon, it is enabled.

Enable GD library support for PHP in Linux

# The following methods are supported to enable the GD Library:
# Check whether the GD Library has the Installation Command
Php5-m | grep-I gd
Or
Php-I | grep-I -- color gd
# If the GD library is not installed, install it on the server as follows:
### If the installation is source code, add the parameter
-- With-gd
### If it is a debian linux system, use apt-get to install it, as shown below:
Apt-get install php5-gd
### If it is a CentOS system, install it using yum, as shown below:
Yum install php-gd
### If the suse linux system is used, install it using yast, as shown below:
Yast-I php5_gd
### If this world is not enough, you can add
First, go to the zlib source code, libpng source code, and gd source code.
Decompress the package to the source code directory.
Zlib Directory
./Configure -- prefix =/usr/local/zlib
Make; make install
Make clean
Libpng Directory
Cp scripts/makefile. linux./makefile
./Configure -- prefix =/usr/local/libpng
Make; make install
Make clean
Gd Directory
./Configure -- prefix =/usr/local/libgd -- with-png =/usr/local/libpng
Make; make install
Make clean
Finally, find [gd] in php. ini and add a line below.
Extension =/usr/local/libgdgd. so
Restart the php service. If not, try reboot.

Okay, but I 'd like to remind you that there are many surprises in the world. If you install the source code and only add the gd Library, the PHP version and library version may vary.

, So:
-There is no guarantee that there will be a return if you pay so much.
-It is not guaranteed that gd. so can be loaded successfully.
-No pregnancy is guaranteed

Therefore, if the source code is used for installation, it is best to add the parameter -- with-gd when compiling PHP.


GD library function

GetImageSize
Purpose: get the image size [I .e., length and width] usage: array GetImageSize (string filename, array [imageinfo]);

ImageArc
Purpose: draw an arc. Usage: int ImageArc (int im, int cx, int cy, int w, int h, int s, int e, int col );

ImageChar
Purpose: write horizontal characters. Usage: int ImageChar (int im, int font, int x, int y, string c, int col );

ImageCharUp
Purpose: write vertical characters usage: int ImageCharup (int im, int font, int x, int y, string c, int col );

ImageColorAllocate
Purpose: Match Color usage: int ImageColorAllocate (int im, int red, int green, int blue );
 
ImageColorTransparent
Purpose: specify the transparent background color usage: int ImageColorTransparent (int im, int [col]);
 
ImageCopyResized
Purpose: copy a new graph and adjust the size. Usage: int ImageCopyResized (int dst_im, int src_im, int dstX, int dstY, int srcX,

Int srcY, int dstW, int DTH, int srcW, int srcH );
 
ImageCreate
Purpose: create a new graph. Usage: int ImageCreate (int x_size, int y_size );
 
ImageDashedLine
Purpose: Dotted line usage: int ImageDashedLine (int im, int x1, int y1, int x2, int y2, int col );
ImageDestroy: End image usage explanation: int ImageDestroy (int im );
 
ImageFill
Purpose: Graphic coloring usage: int ImageFill (int im, int x, int y, int col );

ImageFilledPolygon function: Polygon area coloring usage: int ImageFilledPolygon (int im, array points, int num_points,

Int col );
 
ImageFilledRectangle: specifies the area color of a rectangle. Usage: int ImageFilledRectangle (int im, int x1, int y1, int x2, int

Y2, int col );
 
ImageFillToBorder: specifies the color area. Usage: int ImageFillToBorder (int im, int x, int y, int border,

Int col );
 
ImageFontHeight
Purpose: Get the font height. Usage: int ImageFontHeight (int font );
 
ImageFontWidth function: Get the font width usage: int ImageFontWidth (int font );
 
ImageInterlace: whether to display the image in a staggered manner. Usage: int ImageInterlace (int im, int [interlace]);
 
ImageLine function: draw Real line usage: int ImageLine (int im, int x1, int y1, int x2, int y2, int col );
 
ImageLoadFont function: loading lattice fonts usage: int ImageLoadFont (string file );
 
ImagePolygon function: ing polygon usage: int ImagePolygon (int im, array points, int num_points, int col );
 
ImageRectangle function: draw a rectangle usage: int ImageRectangle (int im, int x1, int y1, int x2, int y2, int col );
 
ImageSetPixel function: Painting point usage: int ImageSetPixel (int im, int x, int y, int col); ImageString function: painting horizontal

String usage: int ImageString (int im, int font, int x, int y, string s, int col );
 
ImageStringUp function: print string usage: int ImageStringUp (int im, int font, int x, int y, string s, int

Col );
 
ImageSX
Purpose: get the image width. Usage: int ImageSX (int im );
 
ImageSY
Purpose: get the image height. Usage: int ImageSY (int im );
 
ImageTTFBBox
Purpose: calculate the region occupied by TTF text. Usage: array ImageTTFBBox (int size, int angle, string fontfile, string text );
 
ImageTTFText: used to write TTF text to the graph: array ImageTTFText (int im, int size, int angle, int x, int y,

Int col, string fontfile, string text); ImageColorAt function: Gets the index value of the specified color in the figure. Usage: int

ImageColorAt (int im, int x, int y );
 
ImageColorClosest
Purpose: calculate the nearest possible use of the color table and the specified color: int ImageColorClosest (int im, int red, int green, int blue );
 
ImageColorExact
Purpose: calculate the specified color index value in the color table. Usage: int ImageColorExact (int im, int red, int green, int blue );
 
ImageColorResolve
Purpose: calculate the index value specified in the color table or closest to the color. Usage: int ImageColorResolve (int im, int red, int green, int

Blue );

ImageColorSet
Purpose: set the color of the specified index on the color table. Usage: boolean ImageColorSet (int im, int index, int red, int green, int

Blue); ImageColorsForIndex function: obtain the color of the specified index on the color table usage: array ImageColorsForIndex (int im, int

Index );
 
ImageColorsTotal
Purpose: calculate the number of colors. Usage: int ImageColorsTotal (int im); ImagePSLoadFont: load PostScript font usage

: Int ImagePSLoadFont (string filename );
 
ImagePSFreeFont
Purpose: remove the PostScript font. Usage: void ImagePSFreeFont (int fontindex );
 
ImagePSEncodeFont
Purpose: convert a PostScript font to a vector. Usage: int ImagePSEncodeFont (string encodingfile );
 
ImagePSText: used to write PostScript text to the graph: array ImagePSText (int image, string text, int font, int

Size, int foreground, int background, int x, int y, int space, int tightness, float angle, int

Antialias_steps );
 
ImagePSBBox: used to calculate the area occupied by PostScript text. Usage: array ImagePSBBox (string text, int font, int size,

Int space, int width, float angle );
 
ImageCreateFromPNG function: retrieve PNG image type usage: int ImageCreateFromPng (string filename );
 
ImagePNG: Create a PNG image. Usage: int ImagePng (int im, string [filename]);
 
ImageCreateFromGIF: int ImageCreateFromGif (string filename );
 
ImageGIF function: create a GIF image. Usage: int ImageGif (int im, string [filename]);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.