Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use original image url in paperclip

What is the original path of image that uploaded by paperclip.

has_attached_file :attachment,
  :url  =>           ":rails_root/public/photos/images/:id/:style/:basename.:extension",
  :default =>        ":rails_root/public/images/no-image-available.png",
  :styles =>          style_options,
  :default_style =>   :gallery

and style_options are

  style_options = {  :thumbnail => {:geometry => '100x100'},
                     :profile_gallery =>  {:geometry => '184x247'}
                  }

In my public folder create 3 folder while one image upload 1. thumbnail, 2. profile_gallary 3. original.

In my view file I call

<%= photo.thumbnail_url %>

My Question is I want to use original path that upload image. I don't want to use thumnail for any particular url. How can I use original path.

Thanks for Advance

like image 754
Dipak Panchal Avatar asked Dec 17 '12 09:12

Dipak Panchal


1 Answers

<%= photo.attachment.url(:original) %>

That will give you the path to the original file, you can also get the other styles if needed:

<%= photo.attachment.url(:thumbnail) %>
<%= photo.attachment.url(:profile_gallery) %>
like image 190
rorra Avatar answered Nov 15 '22 23:11

rorra