Rails, attachinary and PDF thumbnails
I'm using rails and attachinary to upload PDF documents to Cloudinary. I'm having a hard time constructing the cl_image_tag to bring down the thumbnail of the PDF. Could you help me?
This is my approach for the thumbnail of a photo I uploaded
= cl_image_tag p.path, { size: '200x200', crop: :thumb, class: "img-responsive thumbnail" }
But it doesn't work to grab the generated thumbnail of a PDF document uploaded.
-
Hi Kristen,
Sorry for the very late reply, we have noticed that this request was left unattended. I guess this is not relevant anymore but for future reference -
From your code, you use `p.path`. If the value of `p.path` is a full URL, then all of the transformation parameters will be ignored and that URL will be used in your `img` tag. You should make sure that only the public_id of the image is used there. Also, you'd need to also tell Cloudinary in which image format it should be delivered in, otherwise the original PDF would be delivered. Something like the following should work:
= cl_image_tag "img_public_id", { size: '200x200', crop: :thumb, format: :jpg, class: "img-responsive thumbnail" }
Thanks,
Itay
Post is closed for comments.
Comments
1 comment