image_tag only retreiving the public_id of the images
I am new to cloudinary. I try to have it work in RoR with carrierwave
I have set a public_id in my Uploader:
dir_to_upload + Cloudinary::Utils.random_public_id + '.png'
baserep = ''
if Rails.env.development? then
baserep = '/dev_' + Socket.gethostname
baserep + '/user_items/' + model.user_id.to_s + '/'
nothing fancy I just want to have the files stored in a specific folder.
In development when I run my debug, everithing works fine for the file upload, but when I user image_tag or cl_image_tag or cloudinary_url in my view, I only get the public_id and not the full url of the image on Cloudinary servers
Am I missing something ?
Please note that:
- The public ID can't start with a slash (`/`).
- The public ID should exclude the extension part (e.g., `.png`).
Changing these two worked for me when trying it.
How do you perform the upload? Server side or client-side?
Can you share the cl_image_tag line of code you used?
I finally found the problem by debugging the gem source code,
I was passing the url of the image as first parameter instead of sending directly the property of my object
ie cl_image_tag(o.image.url) where I should write cl_image_tag(o.image)
it worked then
thanks for the precisions about the public_id I did not found these specifications in the documentation
Thank you for the update, I'm glad it's working for you now :)
You can have a look at the following for more information regarding the convention of the public_id:
I am getting a
You're not authorized to access this page"
when I click on your link
My apologies, here's the correct link:
Post is closed for comments.