3

My method works perfectly on my local machine, but on Heroku this only works with non-HTTPS images.

This works on Heroku:

result = image.run_command('convert', 'http://image.jpg', 'histogram:info:')

This does not work on Heroku:

result = image.run_command('convert', 'https://alt-image.jpg', 'histogram:info:')

Error:

failed with error:
convert-im6.q16: not authorized `HTTPS' @ error/delegate.c/InvokeDelegate/1717.
convert-im6.q16: unable to open file `': No such file or directory @ error/constitute.c/ReadImage/544.
convert-im6.q16: no images defined `histogram:info:' @ error/convert.c/ConvertImageCommand/3258.

Both work perfectly on my local machine. I've tried testing images from all different sources, images hosted on Imgur, S3, Reddit, Wordpress - none of them are working, do I need to include some sort of access key?

Confused as to why this works offline but not on Heroku.

Kobius
  • 674
  • 7
  • 28
  • 1
    Edit your ImageMagick policy.xml file to uncomment and give read|write permissions for HTTPS. See policy.xml and its possible locations at https://imagemagick.org/script/resources.php – fmw42 Jan 06 '20 at 22:47
  • 1
    Same issue as here except yours if for HTTPS and this one is for PDF. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Jan 07 '20 at 04:50
  • 1
    @fmw42 this helps a lot, looks like it's the correct solution but I can't seem to get Heroku to use the policy.xml file. I've tried following this, but I'm still unable to work with images from a HTTPS source: https://help.heroku.com/RFDJQSG3/how-can-i-override-imagemagick-settings-in-a-policy-xml-file – Kobius Jan 07 '20 at 17:04
  • Sorry, I know nothing about Heroku. – fmw42 Jan 07 '20 at 18:33
  • Hey @Kobius were you able to find a working solution? – NickGnd Jan 19 '21 at 11:38

0 Answers0