2012-12-17 24 views
7

में मूल छवि यूआरएल का उपयोग कैसे करें पेपरक्लिप द्वारा अपलोड की गई छवि का मूल पथ क्या है।पेपरक्लिप

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 3 फ़ोल्डर बनाने

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

हैं मेरी सार्वजनिक फ़ोल्डर में, जबकि एक छवि अपलोड 1. थंबनेल, 2. profile_gallary 3. मूल।

मेरे विचार फ़ाइल में मैं फोन

<%= photo.thumbnail_url %> 

मेरे प्रश्न मैं मूल रास्ता है कि छवि अपलोड का उपयोग करना चाहते है। मैं किसी भी विशेष यूआरएल के लिए thumnail का उपयोग नहीं करना चाहता। मैं मूल पथ का उपयोग कैसे कर सकता हूं।

अग्रिम के लिए धन्यवाद

उत्तर

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

है कि आप मूल फ़ाइल का पथ दे देंगे, आप भी अन्य शैलियों अगर जरूरत प्राप्त कर सकते हैं:

<%= photo.attachment.url(:thumbnail) %> 
<%= photo.attachment.url(:profile_gallery) %>