简体   繁体   English

增加Imagicks最大分辨率

[英]Increasing Imagicks max resolution

I have a client who allows customers to upload large files to manipulate for printing. 我有一个客户端允许客户上传大文件来操作打印。 The site's using Imagick to handle the image, however, when trying to set the max width and height, it wont go any higher than 16000. For example: 该网站使用Imagick处理图像,但是,当尝试设置最大宽度和高度时,它不会高​​于16000.例如:

// This sets the max width to 20000px
php > Imagick::setResourceLimit(9, 20000);
php > echo $image->getResourceLimit(9);
16000

php > Imagick::setResourceLimit(9, 15000);
php > echo $image->getResourceLimit(9);
15000

Is this a limitation of the library or is there something else I need to be configuring? 这是库的限制还是我还需要配置其他东西?

You need to find your policy.xml for ImageMagick and uncomment and set up the lines that look like this: 您需要找到ImageMagickpolicy.xml并取消注释并设置如下所示的行:

<!-- <policy domain="resource" name="memory" value="2GiB"/> -->
<!-- <policy domain="resource" name="width" value="10KP"/> -->
<!-- <policy domain="resource" name="height" value="10KP"/> -->

You should be able to find the file with: 您应该能够找到以下文件:

identify -list configure | grep CONFIGURE_PATH

Sample Output 样本输出

CONFIGURE_PATH /usr/local/Cellar/imagemagick/7.0.8-10/etc/ImageMagick-7/

then append policy.xml to the end of that. 然后将policy.xml附加到其末尾。 So mine is: 我的是:

/usr/local/Cellar/imagemagick/7.0.8-10/etc/ImageMagick-7/policy.xml

If, for some reason you cannot find the policy.xml file by the method above, you can search for it the long (slower) way with: 如果由于某种原因您无法通过上述方法找到policy.xml文件,则可以使用以下方法搜索长(较慢)方式:

find  /usr  /opt /  -name policy.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM