0
votes

This is not duplicate of issues in ImageMagick 6. I am using ImageMagick 7.0.11-5, and not able to read pdf. To make it happen, I have made changes in all occurences of "policy.xml" that i could find on my system, then also restarted Apache, but i am still getting same "ImageMagick UnAuthorised /tmp/xyz-abc.pdf" issue.

I even gave full permissions to "/tmp" folder, changed even folder path in "policy.xml" from /tmp to "/home/my_user" but nothing helped.

I found following four (04) occurences of "policy.xml file, using "find / -iname policy.xml"

/usr/local/etc/ImageMagick-7/policy.xml
/usr/local/share/doc/ImageMagick-7/www/source/policy.xml
/opt/ImageMagick-7.0.11-5/config/policy.xml
/opt/ImageMagick-7.0.11-5/www/source/policy.xml

Shown below are the changed lines in policy.xml file:

<policymap>
  <policy domain="resource" rights="all" name="temporary-path" value="/home/fakhar" />
  <policy domain="resource" rights="all" name="temporary-path" value="/home/fakhar/*" />

  <policy domain="path" rights="read|write" value="/tmp"/>
  <policy domain="path" rights="read|write" value="/tmp/*"/>
  <!-- <policy domain="resource" name="memory" value="2GiB"/> -->
  <!-- <policy domain="resource" name="map" value="4GiB"/> -->
  <!-- <policy domain="resource" name="width" value="10KP"/> -->
  <!-- <policy domain="resource" name="height" value="10KP"/> -->
  <!-- <policy domain="resource" name="list-length" value="128"/> -->
  <!-- <policy domain="resource" name="area" value="100MP"/> -->
  <!-- <policy domain="resource" name="disk" value="16EiB"/> -->
  <!-- <policy domain="resource" name="file" value="768"/> -->
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
  <policy domain="module" rights="all" pattern="{PS,PDF,XPS,GIF,JPEG,PNG,WEBP}" />
  <policy domain="module" rights="all" pattern="*" />
  <policy domain="coder" rights="all" pattern="{PS,PDF,XPS,GIF,JPEG,PNG,WEBP}" />
  <policy domain="coder" rights="all" pattern="*" />
  <policy domain="system" rights="all" pattern="{PS,PDF,XPS,GIF,JPEG,PNG,WEBP}" />
  <policy domain="system" rights="all" pattern="*" />
  <!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
  <!-- <policy domain="path" rights="none" pattern="@*" /> -->
  <!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
  <!-- <policy domain="cache" name="synchronize" value="True"/> -->
  <!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
  <!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
  <!-- <policy domain="system" name="shred" value="2"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- <policy domain="system" name="font" value="/path/to/unicode-font.ttf"/> -->
</policymap>

That is policy.xml file that i have tried but that is not taking effect. I want to do it in ImageMagick 7

1
Edit your delegates.xml file to add the full path to gs (ghostscript) for reading PDF/PS/EPSfmw42

1 Answers

0
votes

Solved:

Despite the fact, i installed ImageMagick version 7, as stated in question, and despite the facts that on command-line the version that i get from "convert --version" shows the version as version 7 of ImageMagick BUT ImageMagick function calls in PHP Script is still taking effect by the "policy.xml" stored in "/etc/ImageMagick-6/"

(Moreover, I did not install ImageMagick-6 on Ubuntu, not at least explicitly. A Linux / Ubuntu expert can tell if it comes with some built-in package of ubuntu ? or, probably it was installed as part of some other package)