Home php教程 php手册 概览PHP GD库函数

概览PHP GD库函数

Jun 13, 2016 am 11:10 AM
php and effect use function picture exist size Library us of

我们在使用

GetImageSize
作用:取得图片的大小[即长与宽]
PHP GD库函用法:array GetImageSize(string filename, array [imageinfo]);

ImageArc
作用:画弧线
用法:int ImageArc(int im, int cx, int cy, int w, int h, int s, int e, int col);

ImageChar
作用:写出横向字符
PHP GD库函用法:int ImageChar(int im, int font, int x, int y, string c, int col);

ImageCharUp
作用:写出竖式字符
用法:int ImageCharup(int im, int font, int x, int y, string c, int col);

ImageColorAllocate
作用:匹配颜色
PHP GD库函用法:int ImageColorAllocate(int im, int red, int green, int blue);

ImageColorTransparent
作用:指定透明背景色
用法:int ImageColorTransparent(int im, int [col]);

ImageCopyResized
作用:复制新图并调整大小
PHP GD库函用法: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
作用:建立新图
用法:int ImageCreate(int x_size, int y_size);

ImageDashedLine
作用:绘虚线
用法:int ImageDashedLine(int im, int x1, int y1, int x2, int y2, int col);

ImageDestroy
PHP GD库函作用:结束图形
用法解释:int ImageDestroy(int im);

ImageFill
作用:图形着色
用法:int ImageFill(int im, int x, int y, int col);

ImageFilledPolygon
作用:多边形区域着色
PHP GD库函用法:int ImageFilledPolygon(int im, array points, int num_points, int col);

ImageFilledRectangle
作用:矩形区域着色
用法:int ImageFilledRectangle(int im, int x1, int y1, int x2, int y2, int col);

ImageFillToBorder
作用:指定颜色区域内着色
PHP GD库函用法:int ImageFillToBorder(int im, int x, int y, int border, int col);

ImageFontHeight
作用:取得字型的高度
用法:int ImageFontHeight(int font);

ImageFontWidth
作用:取得字型的宽度
用法:int ImageFontWidth(int font);

ImageInterlace
作用:使用交错式显示与否
PHP GD库函用法:int ImageInterlace(int im, int [interlace]);

ImageLine
作用:绘实线
用法:int ImageLine(int im, int x1, int y1, int x2, int y2, int col);

ImageLoadFont
作用:载入点阵字型
用法:int ImageLoadFont(string file);

ImagePolygon
作用:绘多边形
用法:int ImagePolygon(int im, array points, int num_points, int col);

ImageRectangle
作用:绘矩形
用法:int ImageRectangle(int im, int x1, int y1, int x2, int y2, int col);

ImageSetPixel
作用:绘点
PHP GD库函用法:int ImageSetPixel(int im, int x, int y, int col);

ImageString
作用:绘横式字符串
用法:int ImageString(int im, int font, int x, int y, string s, int col);

ImageStringUp
作用:绘直式字符串
用法:int ImageStringUp(int im, int font, int x, int y, string s, int col);

ImageSX
作用:取得图片的宽度
用法:int ImageSX(int im);

ImageSY
作用:取得图片的高度
PHP GD库函用法:int ImageSY(int im);

ImageTTFBBox
作用:计算 TTF 文字所占区域
用法:array ImageTTFBBox(int size, int angle, string fontfile, string text);

ImageTTFText
作用:写 TTF 文字到图中
用法:array ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text);

ImageColorAt
作用:取得图中指定点颜色的索引值
用法:int ImageColorAt(int im, int x, int y);

ImageColorClosest
作用:计算色表中与指定颜色最接近者
PHP GD库函用法:int ImageColorClosest(int im, int red, int green, int blue);

ImageColorExact
作用:计算色表上指定颜色索引值
用法:int ImageColorExact(int im, int red, int green, int blue);

ImageColorResolve
作用:计算色表上指定或最接近颜色的索引值
用法:int ImageColorResolve(int im, int red, int green, int blue);

ImageColorSet
作用:设定色表上指定索引的颜色
用法:boolean ImageColorSet(int im, int index, int red, int green, int blue);

ImageColorsForIndex
作用:取得色表上指定索引的颜色
PHP GD库函用法:array ImageColorsForIndex(int im, int index);

ImageColorsTotal
作用:计算图的颜色数
用法:int ImageColorsTotal(int im);

ImagePSLoadFont
作用:载入 PostScript 字型
用法:int ImagePSLoadFont(string filename);

ImagePSFreeFont
作用:卸下 PostScript 字型
用法:void ImagePSFreeFont(int fontindex);

ImagePSEncodeFont
作用:PostScript 字型转成向量字
PHP GD库函用法:int ImagePSEncodeFont(string encodingfile);

ImagePSText
作用:写 PostScript 文字到图中
用法: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
作用:计算 PostScript 文字所占区域
PHP GD库函用法: array ImagePSBBox(string text, int font, int size, int space, int width, float angle);

ImageCreateFromPNG
作用:取出 PNG 图型
用法:int ImageCreateFromPng(string filename);

ImagePNG
作用:建立 PNG 图型
用法:int ImagePng(int im, string [filename]);

ImageCreateFromGIF
作用:取出 GIF 图型
用法:int ImageCreateFromGif(string filename);

ImageGIF
作用:建立 GIF 图型
PHP GD库函用法:int ImageGif(int im, string [filename]);


Statement of this Website
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

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 Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

Explain the match expression (PHP 8 ) and how it differs from switch. Explain the match expression (PHP 8 ) and how it differs from switch. Apr 06, 2025 am 12:03 AM

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

See all articles