How to open GD library support in PHP _php tutorial

Source: Internet
Author: User
Open GD Library is an important parameter in PHP, commonly used to deal with images, such as images of any processing requires the support of the GD library, below I introduce the various systems of GD library open methods and commands, we can refer to.

GD Library support for PHP open under Windows

Locate php.ini, open the content, find:

; Extension=php_gd2.dll

Put the front of the semicolon ";" Remove, and then save, if there is no semicolon, it is already open.

Support for the PHP-enabled GD library under Linux

#开启GD库支持有以下几种方法
# #检测GD库是否安装命令
php5-m | Grep-i GD
Or
Php-i | Grep-i--color GD
# #如未安装GD库, install the server with the following method
# # # If the source is installed, then add parameters
--with-gd
# # # If it's a Debian Linux system, install it with Apt-get, as follows
Apt-get Install PHP5-GD
# # # If it's a centos system, install it with Yum, as follows
Yum Install PHP-GD
# # # If it's a SUSE Linux system, install with YaST, as follows
Yast-i PHP5_GD
# # # If the world is not enough egg pain, you can originally compiled PHP does not support the case of GD attached
First under Zlib source code, libpng source, GD source code
Unzip to source 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 in the php.ini, after searching [GD], add a line below
Extension=/usr/local/libgdgd.so
Then restart the PHP service, if not, try Reboot

Okay, but at the end of the note, to know the world a lot of unexpected, source installation, only add GD library in this case, the PHP version and the library version are different

So:
-There's no guarantee that it pays so much.
-No guarantee to successfully load gd.so
-Not guaranteed not to be pregnant

So if it is the source of the installation, it is best to compile PHP when adding parameters--WITH-GD


GD Library functions

GetImageSize
Effect: Gets the size of the image [i.e. length and width] Usage: array getimagesize (string filename, array [imageinfo]);

Imagearc
Function: Draw arc usage: int imagearc (int im, int cx, int cy, int w, int h, int s, int e, int col);

Imagechar
Function: Write out horizontal character usage: int Imagechar (int im, int font, int x, int y, string c, int col);

Imagecharup
Function: Write down the vertical character usage: int Imagecharup (int im, int font, int x, int y, string c, int col);

Imagecolorallocate
Function: Match color usage: int imagecolorallocate (int im, int red, int green, int blue);

Imagecolortransparent
Function: Specify transparent background color usage: int imagecolortransparent (int im, int [col]);

Imagecopyresized
Function: Copy new diagram and resize usage: int imagecopyresized (int dst_im, int src_im, int dstX, int dsty, int srcx,

int Srcy, int dstw, int dsth, int srcw, int srcH);

Imagecreate
Function: Create a new diagram usage: int imagecreate (int x_size, int y_size);

Imagedashedline
Function: Draw dash usage: int imagedashedline (int im, int x1, int y1, int x2, int y2, int col);
Imagedestroy Effect: End graphics usage Explanation: int Imagedestroy (int im);

Imagefill
Function: Graphical coloring usage: int imagefill (int im, int x, int y, int col);

Imagefilledpolygon Effect: Polygon Area Shading Usage: int imagefilledpolygon (int im, array points, int num_points,

int col);

Imagefilledrectangle Effect: Rectangle area Shading Usage: int imagefilledrectangle (int im, int x1, int y1, int x2, int

y2, int col);

Imagefilltoborder effect: Specifies the color area within the shading usage: int imagefilltoborder (int im, int x, int y, int border,

int col);

Imagefontheight
Function: Obtain the height of the font usage: int imagefontheight (int font);

Imagefontwidth Effect: Obtain the width of the font usage: int imagefontwidth (int font);

Imageinterlace function: Use interleaved display or not usage: int imageinterlace (int im, int [interlace]);

Imageline Effects: Paint solid line usage: int imageline (int im, int x1, int y1, int x2, int y2, int col);

Imageloadfont effect: Load lattice font usage: int imageloadfont (string file);

Imagepolygon effect: Draw polygon Usage: int imagepolygon (int im, array points, int num_points, int col);

Imagerectangle effects: Draw rectangle Usage: int imagerectangle (int im, int x1, int y1, int x2, int y2, int col);

Imagesetpixel effects: Plot point usage: int imagesetpixel (int im, int x, int y, int col); Imagestring effect: Painting horizontal type

string usages: int imagestring (int im, int font, int x, int y, string s, int col);

Imagestringup effect: Draw straight string usage: int imagestringup (int im, int font, int x, int y, string s, int

COL);

Imagesx
Effect: Obtain the width of the image usage: int imagesx (int im);

Imagesy
Effect: Obtain the height of the image usage: int imagesy (int im);

Imagettfbbox
Function: Calculate the area usage of TTF literals: array imagettfbbox (int size, int angle, string fontfile, string text);

Imagettftext Effect: Write TTF text to diagram usage: array imagettftext (int im, int size, int angle, int x, int y,

int col, string fontfile, string text); Imagecolorat effect: Gets the index value of the specified point color in the graph usage: int

Imagecolorat (int im, int x, int y);

Imagecolorclosest
Function: Calculates the closest usage in a color table to a specified color: int imagecolorclosest (int im, int red, int green, int blue);

Imagecolorexact
Function: Calculate the specified color index value on the color table usage: int imagecolorexact (int im, int red, int green, int blue);

Imagecolorresolve
Function: Calculates the index value of the specified or closest color on the color table usage: int imagecolorresolve (int im, int red, int green, int

Blue);

Imagecolorset
Function: Sets the color usage of the specified index on the color table: boolean imagecolorset (int im, int index, int red, int green, int

Blue); Imagecolorsforindex effect: Gets the color usage of the specified index on the color table: array imagecolorsforindex (int im, int

index);

Imagecolorstotal
function: Calculate the color number of the graph usage: int imagecolorstotal (int im); Imagepsloadfont effect: Loading PostScript font usage

: int Imagepsloadfont (string filename);

Imagepsfreefont
Function: Remove PostScript font usage: void imagepsfreefont (int fontindex);

Imagepsencodefont
function: The PostScript font turns into vector word usage: int imagepsencodefont (string encodingfile);

Imagepstext function: Write PostScript text to diagram usage: 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 function: Calculates the area usage of PostScript text: Array imagepsbbox (string text, int font, int size,

int space, int width, float angle);

Imagecreatefrompng Effect: Remove PNG pattern usage: int imagecreatefrompng (string filename);

Imagepng Effect: Establish PNG pattern usage: int imagepng (int im, string [filename]);

Imagecreatefromgif Effect: Remove GIF pattern usage: int imagecreatefromgif (string filename);

Imagegif effect: Create GIF pattern usage: int imagegif (int im, string [filename]);

http://www.bkjia.com/PHPjc/628710.html www.bkjia.com true http://www.bkjia.com/PHPjc/628710.html techarticle Open GD Library is an important parameter in PHP, commonly used to deal with images, such as images of any processing needs to support the GD library, the following I will introduce the various systems of GD library open methods and commands, large ...

  • 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.