不使用Imagick在PHP中将TIFF图像转换为PNG/JPG/GIF
我正在为我的客户处理一个网站,在该网站中,tiff图像在组装成PDF之前需要转换为png或jpg.
I am working on a website for my client in which tiff images need to converted to png or jpg before they are assembled into a PDF.
在此问题和其他站点上,我已经阅读了许多文章.他们都建议使用Imagick来完成此任务.问题是,我的客户的服务器未安装该扩展程序,托管公司不愿意安装该扩展程序.
I have read many articles, here and other sites, on this issue. They all recommend using Imagick to accomplish this. The problem is, my client's server does not have that extension installed, and the hosting company is unwilling to install the extension.
服务器上也未安装PDFLib(支持将tiff导入PDF).
Nor is PDFLib installed on the server (which supports importing tiffs into a PDF).
谢谢.
由于tiff格式,这很棘手.您可以使用本机PHP函数对大多数输入格式执行此操作,以从源文件创建图像对象,然后使用imagejpeg或imagepng保存该对象.但是tiff存在专利问题,我不认为这是受支持的.查看服务器上可用的PHP GD和映像功能.可能对此处的注释有所帮助: http://php. net/manual/en/function.pdf-open-image-file.php
This is tricky because of the tiff format. You can do this for most input formats with native PHP functions to create an image object from the source file and then save that using imagejpeg or imagepng. But tiff has patent issues and I don't think it's supported. Have a look at the PHP GD and image functions available on your server. May be some help in the comments here: http://php.net/manual/en/function.pdf-open-image-file.php