5

I have a model called Tile, and it has attachment: has_attachment :image_attachment

I can use cl_image_tag @tile.image_attachment.path to display img tag but I want to get only full URL to embed is an background image in inline style, is there a way to get full URL?

``@tile.image_attachment.path returns v1458814322/bgo1zuv4kji17f58x5m5.jpg

szromek
  • 153
  • 10

2 Answers2

8

You just need to use cl_image_path(@tile.image_attachment)

rlarcombe
  • 2,958
  • 1
  • 17
  • 22
3

If you want to access the URL somewhere else than in a view file:

options = {width: 50, height: 50, crop: :fill}
Cloudinary::Utils.cloudinary_url(image_id, options)
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232