如何在PHP上传过程中转换tiff格式ti jpg或png foemat

时间:2017-05-02 08:18:08

标签: php html web browser tiff

我有tiff格式的图像,所以我想在PHP的上传过程中将其转换为png或jpg,还是有其他方法或插件可以直接通过浏览器显示我的图像?

1 个答案:

答案 0 :(得分:0)

PHP发布不支持图像处理, 因此,您需要使用ImageMagick,以获取详细信息click here

你可以简单地编写这样的代码。

<?php
// create new imagick object from image.jpg
$im = new Imagick( "image.tiff" );

// change format to png
$im->setImageFormat( "png" );

// output the image to the browser as a png
//header( "Content-Type: image/png" );
//echo $im;

// or you could output the image to a file:
$im->writeImage( "image.png" );
?>
相关问题