我该如何使用PHP将单个jpg图像转换为3种不同的图像格式,包括gif、png和bmp?
我该如何使用PHP将单个jpg图像转换为3种不同的图像格式,包括gif、png和bmp?
你首先需要使用 imagecreatefromjpeg() 函数将文件创建为图像对象。然后,你可以使用不同的格式(例如使用 imagegif())将该对象转换为其他格式:
$imageObject = imagecreatefromjpeg($imageFile);
imagegif($imageObject, $imageFile . '.gif');
imagepng($imageObject, $imageFile . '.png');
imagewbmp($imageObject, $imageFile . '.bmp');
bmp
文件?由于 wbmp 不是 bmp,因此 Ubuntu 中的图像查看器会显示虚假数据。 - prongs