user1946705
user1946705

Reputation: 2888

Paperclip - how to set up the path?

I am already a long time struggling with setting a path for storing an images. I would like to have a path in a shape:

public/photos/88/small/image.jpg

public/photos/88/medium/image.jpg

public/photos/88/original/image.jpg

The number 88 is ID of image gallery. I tried to check some tutorials on google, but I can't find the right way, how to set it.

I am trying in my Photo model:

  has_attached_file :photo,
                    :styles => {:small=> "65x65#",
                                :medium  => "500x500>" },
                    :url => "/public/photos/:album_id/:style_:basename.:extension"

So my first problem is, I don't know, how to get to Photo model the value of album_id, and the second one, how to distinguish the directories for small, medium and original size of image...

Can anyone help me, please, how the path set up?

Thank you so much in advance

Upvotes: 2

Views: 4909

Answers (1)

user1946705
user1946705

Reputation: 2888

http://robots.thoughtbot.com/post/159807063/paperclip-tips-and-updates

And don't forget restart your server! (my problem)

Upvotes: 2

Related Questions