Ruby on Rails Monday, January 29, 2018

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,

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a0573738-f970-4447-91be-759f4fa33b04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment