search
HomeBackend DevelopmentPHP TutorialOverview of PHP GD library functions_PHP tutorial

Overview of PHP GD library functions_PHP tutorial

Jul 15, 2016 pm 01:33 PM
phpandeffectusefunctionpictureexistsizeLibraryusof

We are using

GetImageSize
Function: Get the size of the image [i.e. length and width]
PHP GD library function 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 horizontal characters
PHP GD library function usage: int ImageChar(int im, int font, int x, int y, string c, int col);

ImageCharUp
Function: Write vertical characters
Usage: int ImageCharup(int im, int font, int x, int y, string c, int col);

ImageColorAllocate
Function: Match colors
PHP GD library function usage: int ImageColorAllocate(int im, int red, int green, int blue);

ImageColorTransparent
Function: Specify transparency Background color
Usage: int ImageColorTransparent(int im, int [col]);

ImageCopyResized
Function: Copy new image and resize
PHP GD library function 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 image
Usage: int ImageCreate(int x_size, int y_size);

ImageDashedLine
Function: Draw a dotted line
Usage: int ImageDashedLine(int im, int x1, int y1, int x2, int y2, int col) ;

ImageDestroy
PHP GD library function function: end graphics
Usage explanation: int ImageDestroy(int im);

ImageFill
Function: graphics coloring
Usage :int ImageFill(int im, int x, int y, int col);

ImageFilledPolygon
Function: polygon area coloring
PHP GD library function usage: int ImageFilledPolygon(int im, array points, int num_points, int col);

ImageFilledRectangle
Function: Rectangular area coloring
Usage: int ImageFilledRectangle(int im, int x1, int y1, int x2, int y2, int col);

ImageFillToBorder
Function: Coloring within the specified color area
PHP GD library function usage: int ImageFillToBorder(int im, int x, int y, int border, int col);

ImageFontHeight
Function: Get the height of the font
Usage: int ImageFontHeight(int font);

ImageFontWidth
Function: Get the width of the font
Usage: int ImageFontWidth(int font ; >Function: Draw a solid line

Usage: int ImageLine(int im, int x1, int y1, int x2, int y2, int col);


ImageLoadFont
Function: Load bitmap fonts Type

Usage: int ImageLoadFont(string file);


ImagePolygon
Function: draw polygons

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 : Draw points

PHP GD library function usage: int ImageSetPixel(int im, int x, int y, int col);


ImageString
Function: Draw horizontal string

Usage: int ImageString(int im, int font, int x, int y, string s, int col);


ImageStringUp
Function: Draw a straight string

Usage: int ImageStringUp(int im, int font, int x, int y, string s, int col);


ImageSX
Function: Get the width of the image

Usage: int ImageSX(int im);


ImageSY
Function: Get the height of the image

PHP GD library function usage: int ImageSY(int im);


ImageTTFBBox
Function: Calculate the area occupied by TTF text

Usage: array ImageTTFBBox(int ​​size, int angle, string fontfile, string text);


ImageTTFText
Function: Write TTF text into the image

Usage: array ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text);


ImageColorAt
Function: Get the index value of the color of the specified point in the picture

Usage: int ImageColorAt(int im, int x , int y);


ImageColorClosest
Function: Calculate the closest color to the specified color in the color table

PHP GD library function usage: 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: Calculate 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: 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: Get the specified color table Indexed colors

PHP GD library function usage: array ImageColorsForIndex(int ​​im, int index);


ImageColorsTotal
Function: Calculate the number of colors in the image

Usage: int ImageColorsTotal(int im) ;


ImagePSLoadFont
Function: Load PostScript font

Usage: int ImagePSLoadFont(string filename);


ImagePSFreeFont
Function: Unload PostScript font

Usage: void ImagePSFreeFont(int fontindex);

ImagePSEncodeFont
Function: Convert PostScript fonts into vector words
PHP GD library function usage: int ImagePSEncodeFont(string encodingfile);

ImagePSText
Function: Write PostScript text into the image
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: Calculate the area occupied by PostScript text
PHP GD library function usage: array ImagePSBBox(string text, int font, int size, int space, int width, float angle);

ImageCreateFromPNG
Function: Take out PNG graphics
Usage: int ImageCreateFromPng(string filename);

ImagePNG
Function: Create PNG graphics
Usage: int ImagePng(int im, string [filename]);

ImageCreateFromGIF
Function: Take out GIF graphics
Usage: int ImageCreateFromGif(string filename);

ImageGIF
Function: Create GIF graphics
PHP GD library function usage: int ImageGif(int im, string [filename]);


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446047.htmlTechArticleWe are using GetImageSize Function: Get the size of the image [i.e. length and width] PHP GD library function usage: array GetImageSize (string filename, array [imageinfo]); ImageArc Function: Use to draw arcs...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor