@shaan
2010-Feb-15 16:13 UTC
Changing the :path and :url options of has_attached_file in paperclip
Hello, I am using the paperclip plugin to upload images and it works absolutely fine. I intend to save my uploaded images to C:\Application_name\public folder. Accordingly, with some study over the i-net, I changed the :path option of has_attached_file to - :path => "C:/Application_name/ public/:class/:attachment/:id/:style_:basename.:extension" Now, the files are being saved to the desired path. However, I need to understand what should be the corresponding change in the :url option. I tried everything - :url => "/:id/:style_:basename.:extension" :url => "C:/Application_name/ public/:class/:attachment/:id/:style_:basename.:extension" :url => "/public/:class/:attachment/:id/:style_:basename.:extension" but none of them work. The image couldn''t be displayed. Request, please share any inputs which could help me further to this. Thanks in advance. love-n-peace, @shaan Aal izz well...:-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2010-Feb-15 18:47 UTC
Re: Changing the :path and :url options of has_attached_file in paperclip
On Feb 15, 2010, at 8:13 AM, @shaan wrote:> Hello, > > I am using the paperclip plugin to upload images and it works > absolutely fine. > > I intend to save my uploaded images to C:\Application_name\public > folder. Accordingly, with some study over the i-net, I changed > the :path option of has_attached_file to - > > :path => "C:/Application_name/ > public/:class/:attachment/:id/:style_:basename.:extension" > > Now, the files are being saved to the desired path. However, I need to > understand what should be the corresponding change in the :url option. > > I tried everything - > > :url => "/:id/:style_:basename.:extension" > :url => "C:/Application_name/ > public/:class/:attachment/:id/:style_:basename.:extension" > :url => "/public/:class/:attachment/:id/:style_:basename.:extension" > > but none of them work. The image couldn''t be displayed. > > Request, please share any inputs which could help me further to this.:url => "/:class/:attachment/:id/:style_:basename.:extension" Basically the same thing as :path, starting at where ''public'' leaves off. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
@shaan
2010-Feb-16 03:10 UTC
Re: Changing the :path and :url options of has_attached_file in paperclip
Hello Philip, I have tried this, but unfortunately it has not worked. I can only see the image file name with a cross icon, but the image can''t be seen. Some additional information - in the log, I can see this error (just in case it helps): ActionController::RoutingError (No route matches "/css/iepngfix.htc" with {:method=>:get}):. I am presently working on a single computer. love-n-peace, @shaan ''Aal izz well'' :-) On Feb 15, 10:47 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> On Feb 15, 2010, at 8:13 AM, @shaan wrote: > > > > > > > Hello, > > > I am using the paperclip plugin to upload images and it works > > absolutely fine. > > > I intend to save my uploaded images to C:\Application_name\public > > folder. Accordingly, with some study over the i-net, I changed > > the :path option of has_attached_file to - > > > :path => "C:/Application_name/ > > public/:class/:attachment/:id/:style_:basename.:extension" > > > Now, the files are being saved to the desired path. However, I need to > > understand what should be the corresponding change in the :url option. > > > I tried everything - > > > :url => "/:id/:style_:basename.:extension" > > :url => "C:/Application_name/ > > public/:class/:attachment/:id/:style_:basename.:extension" > > :url => "/public/:class/:attachment/:id/:style_:basename.:extension" > > > but none of them work. The image couldn''t be displayed. > > > Request, please share any inputs which could help me further to this. > > :url => "/:class/:attachment/:id/:style_:basename.:extension" > > Basically the same thing as :path, starting at where ''public'' leaves > off.- Hide quoted text - > > - Show quoted text --- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pat Shaughnessy
2010-Feb-16 15:03 UTC
Re: Changing the :path and :url options of has_attached_file in paperclip
Probably you need to add a corresponding route + controller action to handle the download requests. I wrote a tutorial a while back on this: http://patshaughnessy.net/2009/5/16/paperclip-sample-app-part-2-downloading-files-through-a-controller - pat http://patshaughnessy.net On Feb 15, 10:10 pm, "@shaan" <shaan.masterm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Philip, > > I have tried this, but unfortunately it has not worked. I can only see > the image file name with a cross icon, but the image can''t be seen. > Some additional information - in the log, I can see this error (just > in case it helps): > > ActionController::RoutingError (No route matches "/css/iepngfix.htc" > with {:method=>:get}):. > > I am presently working on a single computer. > > love-n-peace, > @shaan > ''Aal izz well'' :-) > > On Feb 15, 10:47 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: > > > > > On Feb 15, 2010, at 8:13 AM, @shaan wrote: > > > > Hello, > > > > I am using the paperclip plugin to upload images and it works > > > absolutely fine. > > > > I intend to save my uploaded images to C:\Application_name\public > > > folder. Accordingly, with some study over the i-net, I changed > > > the :path option of has_attached_file to - > > > > :path => "C:/Application_name/ > > > public/:class/:attachment/:id/:style_:basename.:extension" > > > > Now, the files are being saved to the desired path. However, I need to > > > understand what should be the corresponding change in the :url option. > > > > I tried everything - > > > > :url => "/:id/:style_:basename.:extension" > > > :url => "C:/Application_name/ > > > public/:class/:attachment/:id/:style_:basename.:extension" > > > :url => "/public/:class/:attachment/:id/:style_:basename.:extension" > > > > but none of them work. The image couldn''t be displayed. > > > > Request, please share any inputs which could help me further to this. > > > :url => "/:class/:attachment/:id/:style_:basename.:extension" > > > Basically the same thing as :path, starting at where ''public'' leaves > > off.- Hide quoted text - > > > - Show quoted text --- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
@shaan
2010-Feb-18 18:17 UTC
Re: Changing the :path and :url options of has_attached_file in paperclip
Hello Pat, It worked out with a charm :-) Thanks a ton for the solution... love-n-peace, @shaan ''Aal izz well'' :-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.