位置: 编程技术 - 正文

PHP:imagejpeg()的用法_GD库图像处理函数(php中imagestring)

编辑:rootadmin
imagejpeg

推荐整理分享PHP:imagejpeg()的用法_GD库图像处理函数(php中imagestring),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php imagettftext()函数,php imagecopy,php中imagecreatefromjpeg,php image,php中imagestring,php imagefill,php imagefill,php image,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4, PHP 5)

imagejpeg — 输出图象到浏览器或文件。

说明 bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )

imagejpeg() 从 image 图像以 filename 为文件名创建一个 JPEG 图像。

参数

image

由图象创建函数(例如imagecreatetruecolor())返回的图象资源。

filename

文件保存的路径,如果未设置或为 NULL,将会直接输出原始图象流。

如果要省略这个参数而提供 quality 参数,使用NULL。

quality

quality 为可选项,范围从 0(最差质量,文件更小)到 (最佳质量,文件最大)。默认为 IJG 默认的质量值(大约 )。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE。

范例 PHP:imagejpeg()的用法_GD库图像处理函数(php中imagestring)

Example #1 输出 JPEG 图像

<?php//创键空白图像并添加一些文本$im=imagecreatetruecolor(,);$text_color=imagecolorallocate($im,,,);imagestring($im,1,5,5,'ASimpleTextString',$text_color);//设置内容类型标头——这个例子里是image/jpegheader('Content-Type:image/jpeg');//输出图像imagejpeg($im);//释放内存imagedestroy($im);?>

以上例程的输出类似于:

Example #2 保存一副 JPEG 图像

<?php//创键空白图像并添加一些文本$im=imagecreatetruecolor(,);$text_color=imagecolorallocate($im,,,);imagestring($im,1,5,5,'ASimpleTextString',$text_color);//保存图像为'simpletext.jpg'imagejpeg($im,'simpletext.jpg');//释放内存imagedestroy($im);?>

Example #3 以 % 的图像质量输出图像

<?php//创键空白图像并添加一些文本$im=imagecreatetruecolor(,);$text_color=imagecolorallocate($im,,,);imagestring($im,1,5,5,'ASimpleTextString',$text_color);//设置内容类型标头——这个例子里是image/jpegheader('Content-Type:image/jpeg');//使用NULL跳过filename参数,并设置图像质量为%imagejpeg($im,NULL,);//释放内存imagedestroy($im);?>

注释

Note: JPEG 支持仅在 PHP 与 GD-1.8 或更高版本一起编译时可用。

Note:

如果想输出渐进式 JPEG,需要用 imageinterlace() 函数将隔行扫描比特置位。

参见

imagepng() - 以 PNG 格式将图像输出到浏览器或文件 imagegif() - 输出图象到浏览器或文件。 imagewbmp() - 以 WBMP 格式将图像输出到浏览器或文件 imageinterlace() - 激活或禁止隔行扫描 imagetypes() - 返回当前 PHP 版本所支持的图像类型

PHP:imageistruecolor()的用法_GD库图像处理函数 imageistruecolor(PHP4=4.3.2,PHP5)imageistruecolor检查图像是否为真彩色图像说明boolimageistruecolor(resource$image)imageistruecolor()检查image图像是否为真彩色图像。参数image

PHP:imageinterlace()的用法_GD库图像处理函数 imageinterlace(PHP4,PHP5)imageinterlace激活或禁止隔行扫描说明intimageinterlace(resource$image[,int$interlace])imageinterlace()打开或关闭隔行扫描的比特标记。如果interlace为

PHP:imagegif()的用法_GD库图像处理函数 imagegif(PHP4,PHP5)imagegif输出图象到浏览器或文件。说明boolimagegif(resource$image[,string$filename])imagegif()从image图像以filename为文件名创建一个GIF图像。image参数是

本文链接地址:https://www.jiuchutong.com/biancheng/288331.html 转载请保留说明!

上一篇:PHP:imagelayereffect()的用法_GD库图像处理函数

下一篇:PHP:imageistruecolor()的用法_GD库图像处理函数

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络