Php 什么是图像资源标识符?
我正在阅读函数Php 什么是图像资源标识符?,php,Php,我正在阅读函数imagecreatetruecolor的php,该函数成功返回图像资源标识符。“图像资源标识符”是什么意思?我在PHP文档中搜索了这个术语,但在文档的前两页中没有找到它。它基本上只是一种特殊类型的对象,用于gdlib-其他函数将需要此资源作为参数,例如 它存储有关正在创建的图像的信息,以便稍后使用其他函数进行进一步修改 php.net中关于资源的一点信息图像资源标识符是一种结构(用C术语)定义,用于保存有关图像的信息。以下是它在PHP源代码中的定义: typedef struct
imagecreatetruecolor
的php,该函数成功返回图像资源标识符。“图像资源标识符”是什么意思?我在PHP文档中搜索了这个术语,但在文档的前两页中没有找到它。它基本上只是一种特殊类型的对象,用于gdlib
-其他函数将需要此资源作为参数,例如
它存储有关正在创建的图像的信息,以便稍后使用其他函数进行进一步修改
php.net中关于资源的一点信息图像资源标识符是一种结构(用C术语)定义,用于保存有关图像的信息。以下是它在PHP源代码中的定义:
typedef struct gdImageStruct {
/* Palette-based image pixels */
unsigned char ** pixels;
int sx;
int sy;
/* These are valid in palette images only. See also
'alpha', which appears later in the structure to
preserve binary backwards compatibility */
int colorsTotal;
int red[gdMaxColors];
int green[gdMaxColors];
int blue[gdMaxColors];
int open[gdMaxColors];
/* For backwards compatibility, this is set to the
first palette entry with 100% transparency,
and is also set and reset by the
gdImageColorTransparent function. Newer
applications can allocate palette entries
with any desired level of transparency; however,
bear in mind that many viewers, notably
many web browsers, fail to implement
full alpha channel for PNG and provide
support for full opacity or transparency only. */
int transparent;
int *polyInts;
int polyAllocated;
struct gdImageStruct *brush;
struct gdImageStruct *tile;
int brushColorMap[gdMaxColors];
int tileColorMap[gdMaxColors];
int styleLength;
int stylePos;
int *style;
int interlace;
/* New in 2.0: thickness of line. Initialized to 1. */
int thick;
/* New in 2.0: alpha channel for palettes. Note that only
Macintosh Internet Explorer and (possibly) Netscape 6
really support multiple levels of transparency in
palettes, to my knowledge, as of 2/15/01. Most
common browsers will display 100% opaque and
100% transparent correctly, and do something
unpredictable and/or undesirable for levels
in between. TBB */
int alpha[gdMaxColors];
/* Truecolor flag and pixels. New 2.0 fields appear here at the
end to minimize breakage of existing object code. */
int trueColor;
int ** tpixels;
/* Should alpha channel be copied, or applied, each time a
pixel is drawn? This applies to truecolor images only.
No attempt is made to alpha-blend in palette images,
even if semitransparent palette entries exist.
To do that, build your image as a truecolor image,
then quantize down to 8 bits. */
int alphaBlendingFlag;
/* Should antialias functions be used */
int antialias;
/* Should the alpha channel of the image be saved? This affects
PNG at the moment; other future formats may also
have that capability. JPEG doesn't. */
int saveAlphaFlag;
/* 2.0.12: anti-aliased globals */
int AA;
int AA_color;
int AA_dont_blend;
unsigned char **AA_opacity;
int AA_polygon;
/* Stored and pre-computed variables for determining the perpendicular
* distance from a point to the anti-aliased line being drawn:
*/
int AAL_x1;
int AAL_y1;
int AAL_x2;
int AAL_y2;
int AAL_Bx_Ax;
int AAL_By_Ay;
int AAL_LAB_2;
float AAL_LAB;
/* 2.0.12: simple clipping rectangle. These values must be checked for safety when set; please use gdImageSetClip */
int cx1;
int cy1;
int cx2;
int cy2;
gdInterpolationMethod interpolation_id;
interpolation_method interpolation;
} gdImage;
请参阅手册中的示例-这是您创建的图像资源。随后调用的每个GD函数都需要该图像标识符来知道它应该处理哪个图像。就php而言,可以使用该变量来标识特定图像。大致相当于windows land中的HBITMAP。它可能只是一个表示图像的对象,用于其他图像查询和操作方法。