php gd imagecreatefromstring() 和图像 mime 类型

标签 php gd mime-types

有没有办法使用 imagecreatefromstring() 并以某种方式获取图像类型?

最佳答案

当您使用 imagecreatefrom... 方法时,图像将作为未压缩的位图加载到内存中。此时并没有真正的图像类型。您可以使用图像...功能将其保存为您希望的任何类型。

$img = imagecreatefromstring($data);

imagepng($img, "file path and name");

imagedestroy($img);

http://us2.php.net/manual/en/function.imagecreatefromstring.php

关于php gd imagecreatefromstring() 和图像 mime 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7175883/

相关文章:

ios - 无法通过 Trello API 从 iOS 上传图像作为附件

php - 这个方法应该分解成单独的方法吗?

在 WHERE 子句中使用变量时 PHP MySQL 更新不起作用

php - 如何从图像中获取特定颜色范围的位置?

php - 图像缓存不会显示新编辑的图像

iphone - 如何在 objective-c 中读取 MIME 类型的文件

PHP 获取数据库一个月中的几天

php - 一次向数据库中插入多条数据

PHP: 图像 ftbbox

ios5 - 如何使用配置 MIME 类型设置 cocoahttpserver