开发者

ImageMagick Error in Django's aino-convert app

开发者 https://www.devze.com 2023-01-18 23:25 出处:网络
I\'m using aino-convert on a project and running into an issue I\'ve never seen before. I\'ve taken the exact same code from another project where I\'ve used aino-convert, but it\'s blowing up with an

I'm using aino-convert on a project and running into an issue I've never seen before. I've taken the exact same code from another project where I've used aino-convert, but it's blowing up with an ImageMagick error in the new project. My template code looks like this:

{% thumbnail img.image "156x106" as thumb %}
<img src="{{ thumb }}" alt="{{ img.name }}" />

and that results in the following TemplateSyntaxError:

Caught ExecuteException while rendering: Magick: invalid argument for option `-resize': '156x106' @ error/convert.c/ConvertImageCommand/2343.

I've tried playing around with the sizes to see if it was an issue with the source image. I've tried removing the quotation marks and not aliasing the result to a variable, but it all results in that same error. I'm running ImageMagick 6.6.开发者_如何学Python2 on Windows, also seeing the error on the live Linux server.


make sure that the x character in size option "156x106" is really lower case letter x and not e.g. multiplication sign ×

UPDATE

alternatively, you can try using different syntax:

{% convert img.image "-resize 156x106" as thumb %}


Are you sure Django Template Engine is not interpreting the x in 156x106 as hexa-decimal?

That way by the thin aino (or convert) gets the resize options it's all screwed up. This could cause the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号