2012-12-17 11 views
7

ペーパークリップでアップロードした画像の元のパスとは何ですか?オリジナルの画像URLをクリップで使用する方法

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 

とstyle_options画像が1枚1サムネイル、2 profile_gallary 3.元をアップロードしながら3フォルダを作成し、私のパブリックフォルダで

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

です。私は

<%= photo.thumbnail_url %> 

呼び出す私のビューファイルで

は私の質問は、私は、画像をアップロード元のパスを使用したいです。私は特定のURLにthumnailを使用したくない。どのように元のパスを使用することができます。必要に応じて、元のファイルへのあなたの道を与えるアドバンス

答えて

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

ため

おかげで、あなたはまた、他のスタイルを取得することができます:

<%= photo.attachment.url(:thumbnail) %> 
<%= photo.attachment.url(:profile_gallery) %> 
関連する問題