Home > Software design >  Use ActiveStorage Image in wicked_pdf
Use ActiveStorage Image in wicked_pdf

Time:05-30

I can't get ActiveStorage images to work in production. I want to use a resized image (variant) within the body of the PDF I'm generating.

= image_tag(@post.image.variant(resize_to_limit: [150, 100]))

It worked in development but in production generating the PDF hangs indefinitely unless I take that line out.

I've tried things like @post.image.variant(resize_to_limit: [150, 100]).processed.url and setting Rails.application.default_url_options = { host: "example.com" }

Ironically when I restart Passenger it sends the PDF to the browser and it actually looks fine. The image is included.

This is similar:

= wicked_pdf_image_tag(@post.image.variant(resize_to_limit: [150, 100]).processed.url)

Rails 7.0.3, Ruby 3.1.2, wicked_pdf 2.6.3

CodePudding user response:

Thanks to @Unixmonkey I added passenger_min_instances 2; to my server block in Nginx config and it works!

  • Related