metadata - How to retreive image captions from cloudinary and rails? -


i'm trying add caption below cloudinary image. on cloudinary website, i've added caption under "edit metadata" field, can't figure out how retrieve it.

my controller:

require 'cloudinary' results = cloudinary::api.resources(:type => :upload) resources = results["resources"] @ids = resources.map {|res| res["public_id"]} 

my view:

<% @ids.each |id| %>   <%= cl_image_tag (id) %>   **insert caption here** <% end %> 

to image metadata you've inserted, you'll have set context true when running resources method, this:

results = cloudinary::api.resources(:type => :upload, :context => true)

the above request return key-value pairs in metadata you've inserted, this:

"context"=>{"custom"=>{"caption"=>"flowers"}}


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -