I was recently experimenting with Rails 5.2, particularly the ActiveStorage bit. I was attempting to allow a file attachment (PDF) to be thumbnailed on a as a PNG using some example code I found in the documentation:
image_tag @user.file.preview(resize: “640x280”)
Tracing through the resulting error, it appeared to be mired in
identify not being able to figure out that the Tempfile that AS created at the start of the preview task was a PDF. I had all of the dependencies installed on my Mac -
mupdf and its predicate,
xquartz. I haven’t tried this on a Linux server yet. Has anyone else gotten this to work on their Mac?
Tracing through the code in ActiveStorage, I saw that it was supposed to create a Tempfile with the dot-suffix to match the original file, but in the error, I did not see that behavior. (And I know, dot-suffixes cannot be trusted at all.) I tried looking to see what could be overriding AS’s code (maybe MiniMagick?) but I could not figure it out.
Thanks in advance,