berlinonline / converjon

An advanced image conversion server and command line tool.
http://berlinonline.github.io/converjon/
MIT License
53 stars 8 forks source link

NaNs in crop arguments. #27

Closed selfawaresoup closed 11 years ago

selfawaresoup commented 11 years ago

Apparently there is apossibiliuty that NaN values find their way into command line arguments.

[Mon, 11 Mar 2013 14:41:03 GMT] Process error output convert ./cache/source/www.berlinonline.de/image.php/localnews/asset-25929 -crop NaNxNaN+NaN+NaN -resize 620x250! jpg:./cache/target/www.berlinonline.de/image.php/localnews/asset-25929/0bd13514a1f6933aedf08795e3efece708b81bebcaa58d5a07919f0a0f065068.jpeg convert: invalid argument for option `-crop': NaNxNaN+NaN+NaN @ error/convert.c/ConvertImageCommand/1090.\n"
selfawaresoup commented 11 years ago

possible cause: https://github.com/berlinonline/converjon/blob/1.6.3/lib/converter.js#L64

if the value passed to parseInt is "", null or undefined, the result is "NaN"

this happens when the aoi variable is still empty because the image metadata didn't provide aoi data.

solution: Initialize the aoi with meaningful default values.