PHP:gif到png
如何在PHP中将gif图像转换并保存为PNG?我已经试过几种方法,但都不管用。我无法手动执行此操作,因为这些图像是在其他站点生成的。您可以使用imagecreatefromgif[]函数加载GIF,然后使用imagepng[]函数将其输出为PNG图像。您还应该发送标题内容类型:image/png,以确保浏览器对其进行正确解释PHP:gif到png,php,gd,Php,Gd,如何在PHP中将gif图像转换并保存为PNG?我已经试过几种方法,但都不管用。我无法手动执行此操作,因为这些图像是在其他站点生成的。您可以使用imagecreatefromgif[]函数加载GIF,然后使用imagepng[]函数将其输出为PNG图像。您还应该发送标题内容类型:image/png,以确保浏览器对其进行正确解释 <?php $i = imagecreatefromgif("path or URL of file"); header("Content-Type: image/p
<?php
$i = imagecreatefromgif("path or URL of file");
header("Content-Type: image/png");
imagepng($i);
?>
如果要将其保存到文件,而不是发送到浏览器,请执行以下操作:
<?php
$i = imagecreatefromgif("path or URL of file");
imagepng($i, "converted.png");
?>
你尝试了什么?手册有所有的答案,它实际上只涉及两个功能:,。用谷歌搜索php gif到png显示你需要的一切