PHP image_type_to_extension - 获取图片后缀

PHP 教程 · 2019-01-31 07:14:05

image_type_to_extension — 根据指定的图像类型返回对应的后缀名。

语法

string image_type_to_extension ( int $imagetype [, bool $include_dot = TRUE ] )

根据给定的常量 IMAGETYPE_XXX 返回后缀名。

实例

<?php
// 创建图像实例
$im = imagecreatetruecolor(100, 100);

// 保存图像 png 格式
imagepng($im, './test' . image_type_to_extension(IMAGETYPE_PNG));
imagedestroy($im);
?>

执行以上文件会在当期目录下生成一个 test.png 的图片。

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Scalability Rules

Scalability Rules

Martin L. Abbott、Michael T. Fisher / Addison-Wesley Professional / 2011-5-15 / USD 29.99

"Once again, Abbott and Fisher provide a book that I'll be giving to our engineers. It's an essential read for anyone dealing with scaling an online business." --Chris Lalonde, VP, Technical Operatio......一起来看看 《Scalability Rules》 这本书的介绍吧!

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具