Scott
2007-May-07 20:44 UTC
attachment_fu seems to be searching the wrong location for my images
I just installed attachment_fu and for some reason, it seems to be looking in the wrong location for my images. I have a Product model that belongs to a photo model. the photo model has the attachment_fu installed and configured like so: class Photo < ActiveRecord::Base has_attachment :content_type => :image, #Allow standard image formats :path_prefix => ''public/photos'', #Where to store the uploaded images (shouldn''t need this) :storage => :file_system, #Store files in the filesystem :max_size => 1.megabyte, #Maximum image size, 1Mb :thumbnails => {:thumb => ''120x90''} #Create one thumbnail 120x90 validates_as_attachment end In my Product model, I have a method to return the file path for simplification or a stock image if not found: def photo_filename retval = "/images/no_image.gif" unless not photo.nil? then retval = photo.public_filename end retval end For some reason, Product.photo_filename keeps returning my $HOME directory: No such file or directory - "/Users/stamosunas" The whole trace is below... it seems to be in the attachment_fu code itself where there is a problem: /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in `mkdir'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in `rootdir'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:84:in `directory'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:258:in `so_name'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:292:in `load_cache'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:659:in `inline'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/image_science-1.1.2/lib/image_science.rb:84 /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu/processors/image_science_processor.rb:1 /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:203:in `load_without_new_constant_marking'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:203:in `load_file'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:202:in `load_file'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:94:in `require_or_load'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:248:in `load_missing_constant'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:452:in `const_missing'' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu.rb:85:in `const_get'' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu.rb:85:in `has_attachment'' #{RAILS_ROOT}/app/models/photo.rb:7 #{RAILS_ROOT}/app/models/product.rb:150:in `photo_filename'' #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:20:in `_run_rhtml_47app47views47mgs47_featured_items46rhtml'' #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:13:in `each'' #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:13:in `_run_rhtml_47app47views47mgs47_featured_items46rhtml'' #{RAILS_ROOT}/app/views/mgs/index.rhtml:4:in `_run_rhtml_47app47views47mgs47index46rhtml'' #{RAILS_ROOT}/app/controllers/mgs_controller.rb:14:in `call'' #{RAILS_ROOT}/app/controllers/mgs_controller.rb:14 /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ bin/mongrel_rails:16:in `load'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ bin/mongrel_rails:16 Any idea would be helpful. Thanks! Scott --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Scott
2007-May-08 01:08 UTC
Re: attachment_fu seems to be searching the wrong location for my images
Update: This seems to be an issue with ImageScience. When I installed and switched over to ImageMagick with RMagick, I was able to upload a photo and have the thumbnail created correctly. Scott Scott wrote:> I just installed attachment_fu and for some reason, it seems to be > looking in the wrong location for my images. > > I have a Product model that belongs to a photo model. the photo model > has the attachment_fu installed and configured like so: > > class Photo < ActiveRecord::Base > has_attachment :content_type => :image, #Allow > standard image formats > :path_prefix => ''public/photos'', #Where to > store the uploaded images (shouldn''t need this) > :storage => :file_system, #Store > files in the filesystem > :max_size => 1.megabyte, #Maximum > image size, 1Mb > :thumbnails => {:thumb => ''120x90''} #Create one > thumbnail 120x90 > > validates_as_attachment > end > > In my Product model, I have a method to return the file path for > simplification or a stock image if not found: > > def photo_filename > retval = "/images/no_image.gif" > > unless not photo.nil? then > retval = photo.public_filename > end > retval > end > > For some reason, Product.photo_filename keeps returning my $HOME > directory: > > No such file or directory - "/Users/stamosunas" > > The whole trace is below... it seems to be in the attachment_fu code > itself where there is a problem: > > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in `mkdir'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in `rootdir'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:84:in > `directory'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:258:in `so_name'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:292:in > `load_cache'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:659:in `inline'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/image_science-1.1.2/lib/image_science.rb:84 > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `gem_original_require'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:342:in `new_constants_in'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ > attachment_fu/processors/image_science_processor.rb:1 > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:203:in `load_without_new_constant_marking'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:203:in `load_file'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:342:in `new_constants_in'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:202:in `load_file'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:94:in `require_or_load'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:248:in `load_missing_constant'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:452:in `const_missing'' > #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ > attachment_fu.rb:85:in `const_get'' > #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ > attachment_fu.rb:85:in `has_attachment'' > #{RAILS_ROOT}/app/models/photo.rb:7 > #{RAILS_ROOT}/app/models/product.rb:150:in `photo_filename'' > #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:20:in > `_run_rhtml_47app47views47mgs47_featured_items46rhtml'' > #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:13:in `each'' > #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:13:in > `_run_rhtml_47app47views47mgs47_featured_items46rhtml'' > #{RAILS_ROOT}/app/views/mgs/index.rhtml:4:in > `_run_rhtml_47app47views47mgs47index46rhtml'' > #{RAILS_ROOT}/app/controllers/mgs_controller.rb:14:in `call'' > #{RAILS_ROOT}/app/controllers/mgs_controller.rb:14 > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > bin/mongrel_rails:16:in `load'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ > bin/mongrel_rails:16 > > Any idea would be helpful. > > Thanks! > > Scott--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---