Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't store resized pdf as jpg #483

Open
dedekm opened this issue Mar 9, 2018 · 5 comments
Open

Can't store resized pdf as jpg #483

dedekm opened this issue Mar 9, 2018 · 5 comments

Comments

@dedekm
Copy link

dedekm commented Mar 9, 2018

Command failed ('convert' '/tmp/dragonfly20180309-24076-u498ms' '-quality' '90' '/tmp/dragonfly20180309-24076-zurgvd.jpg') with exit status 1 and stderr convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: no images defined `/tmp/dragonfly20180309-24076-zurgvd.jpg' @ error/convert.c/ConvertImageCommand/3210.

I'm trying to resize first page of PDF to JPG and then store it at s3.
pdf_file.thumb('200x200', format: :jpg, frame: 0) works fine and produce resized thumbnail of pdf.
but pdf_file.thumb('200x200', format: :jpg, frame: 0).store produce invalid file!

@dedekm
Copy link
Author

dedekm commented Mar 14, 2018

i found the solution
pdf_file.thumb('200x200', 'format' => :jpg, 'frame' => 0).store works because imagemagick plugin accepts only string keys

this is the file where is the problem:
lib/dragonfly/image_magick/processors/convert.rb

@stahor
Copy link

stahor commented Mar 21, 2018

+1
I wasted 2 hours trying to understand what happens. This have to be described in documentation. Or it's even better to replace options hash with hash with indifferent access

@markevans
Copy link
Owner

hash with indifferent access is a rails thing.
I specifically don't want to convert between symbols and strings because it adds complexity in other areas.
String keys were chosen because they easily JSON serialize/deserialize.
When you say it should be described in the documentation, I'm not sure what you mean as in http://markevans.github.io/dragonfly/imagemagick it clearly uses string keys.
Do you mean there should be a note of emphasis? If so where would you put it? The problem is of course that I have to balance catering for people overlooking things with keeping the docs clear and concise, which is no easy feat! ;)

@dedekm
Copy link
Author

dedekm commented Mar 23, 2018

you are right that in the documentation iit uses string keys, didn't noticed that...
but file.thumb works with symbol keys, .store doesn't (symbol keys are ignored), so thats why I was confused

@stahor
Copy link

stahor commented Mar 23, 2018

What about adding your own implementation of stringify_keys for example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants