Anthony Ettinger
2007-Dec-22 23:43 UTC
attachment_fu not saving other attributes (like width, height)
http://pastie.caboo.se/131759 I''m only getting the basic filename, product_id for the image, and size (kb). I am *not* getting the thumbnail generated (in db or filesystem), nor is it resizing the image as depicted in the Picture model | id | parent_id | content_type | filename | thumbnail | size | width | height | product_id | --------------------------------------------------------------------------------------------------------------------------------- | 3 | NULL | image/png | ico_lh_creds_untrained.png | NULL | 3064 | NULL | NULL | 21 | | 4 | NULL | image/png | ico_msg_ok.png | NULL | 6662 | NULL | NULL | 21 | I am unclear what I''m doing wrong here. Please see the source example at http://pastie.caboo.se/131759 -- Anthony Ettinger 408-656-2473 http://anthony.ettinger.name @pets = Pets.find_all_by_species(''dog'') @pets.each do |dog| { if dog.name == ''Farley'' dog.nick = ''Sir Barks-A-lot'' elsif dog.name == ''Bonita'' dog.nick = ''Princess Boo'' else dog.nick = ''Doggie?'' end } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rick Olson
2007-Dec-23 00:05 UTC
Re: attachment_fu not saving other attributes (like width, height)
On Dec 22, 2007 6:43 PM, Anthony Ettinger <ettinger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > http://pastie.caboo.se/131759 > > I''m only getting the basic filename, product_id for the image, and size (kb). > > I am *not* getting the thumbnail generated (in db or filesystem), nor > is it resizing the image as depicted in the Picture model > > | id | parent_id | content_type | filename | > thumbnail | size | width | height | product_id | > --------------------------------------------------------------------------------------------------------------------------------- > | 3 | NULL | image/png | ico_lh_creds_untrained.png | NULL > | 3064 | NULL | NULL | 21 | > | 4 | NULL | image/png | ico_msg_ok.png | NULL > | 6662 | NULL | NULL | 21 | > > > I am unclear what I''m doing wrong here. > > Please see the source example at http://pastie.caboo.se/131759You probably don''t have an image processor installed correctly then. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-23 12:15 UTC
Re: attachment_fu not saving other attributes (like width, height)
On Dec 22, 4:05 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 22, 2007 6:43 PM,AnthonyEttinger <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > >http://pastie.caboo.se/131759 > > > I''m only getting the basic filename, product_id for the image, and size (kb). > > > I am *not* getting the thumbnail generated (in db or filesystem), nor > > is it resizing the image as depicted in the Picture model > > > | id | parent_id | content_type | filename | > > thumbnail | size | width | height | product_id | > > --------------------------------------------------------------------------------------------------------------------------------- > > | 3 | NULL | image/png | ico_lh_creds_untrained.png | NULL > > | 3064 | NULL | NULL | 21 | > > | 4 | NULL | image/png | ico_msg_ok.png | NULL > > | 6662 | NULL | NULL | 21 | > > > I am unclear what I''m doing wrong here. > > > Please see the source example athttp://pastie.caboo.se/131759 > > You probably don''t have an image processor installed correctly then. >Could it possibly be the way I''m adding the uploaded image? @product = Product.find(params[:id]) @product.pictures.build(params[:picture]) if @product.update_attributes(params[:product]) flash[:notice] = ''Product was successfully updated.'' redirect_to :action => ''show'', :id => @product else render :action => ''edit'' end I saw some other posts about a bug with attachment_fu and update_attributes. How do I ensure I"ve got the image processor installed properly? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-23 14:06 UTC
Re: attachment_fu not saving other attributes (like width, height)
On Dec 23, 4:15 am, chovy <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 22, 4:05 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Dec 22, 2007 6:43 PM,AnthonyEttinger <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >http://pastie.caboo.se/131759 > > > > I''m only getting the basic filename, product_id for the image, and size (kb). > > > > I am *not* getting the thumbnail generated (in db or filesystem), nor > > > is it resizing the image as depicted in the Picture model > > > > | id | parent_id | content_type | filename | > > > thumbnail | size | width | height | product_id | > > > --------------------------------------------------------------------------------------------------------------------------------- > > > | 3 | NULL | image/png | ico_lh_creds_untrained.png | NULL > > > | 3064 | NULL | NULL | 21 | > > > | 4 | NULL | image/png | ico_msg_ok.png | NULL > > > | 6662 | NULL | NULL | 21 | > > > > I am unclear what I''m doing wrong here. > > > > Please see the source example athttp://pastie.caboo.se/131759 > > > You probably don''t have an image processor installed correctly then. > > Could it possibly be the way I''m adding the uploaded image? > > @product = Product.find(params[:id]) > @product.pictures.build(params[:picture]) > if @product.update_attributes(params[:product]) > flash[:notice] = ''Product was successfully updated.'' > redirect_to :action => ''show'', :id => @product > else > render :action => ''edit'' > end > > I saw some other posts about a bug with attachment_fu and > update_attributes. How do I ensure I"ve got the image processor > installed properly?I apologize for jumping the gun. Re-emerging imagemagick and re- installing "gem install rmagick" fixed the problem. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-23 15:10 UTC
Re: attachment_fu not saving other attributes (like width, height)
I am unable however to make the case where an image is optional. I want to require an image on :create, but make it option on :edit/:update --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bcp
2007-Dec-24 02:47 UTC
Re: attachment_fu not saving other attributes (like width, height)
Enclose the image upload in its own form Sent from my iPhone On Dec 23, 2007, at 7:10 AM, chovy <ettinger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I am unable however to make the case where an image is optional. > > I want to require an image on :create, but make it option > on :edit/:update > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-24 03:38 UTC
Re: attachment_fu not saving other attributes (like width, height)
I was able to get the effect with this line inside the "update" method for ProductController: @product.pictures.build(params[:picture]) unless params[:picture] [:uploaded_data].blank? if @product.update_attributes(params[:product]) ... end On Dec 23, 6:47 pm, Bcp <bcpar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Enclose the image upload in its own form > > Sent from my iPhone > > On Dec 23, 2007, at 7:10 AM, chovy <ettin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I am unable however to make the case where an image is optional. > > > I want to require an image on :create, but make it option > > on :edit/:update--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
fredistic
2007-Dec-24 11:26 UTC
Re: attachment_fu not saving other attributes (like width, height)
When I try to validate height and width in my image model (which is using attachement_fu) it fails validation. Yet when I examine the database, those fields are properly filled in. I''ve removed the validation for now, yet this bothers me. I guess attachment_fu must have overridden the model save! method but I don''t see where this happens. Any clues would be appreciated. Is there a way to validate that the image processor is installed correctly? I find that generating thumbnails simply hangs, so I''ve turned that off while I work on other parts of the project. I''m developing on windows xp and rails 2.0.2. Are there any mods or updates needed for rails 2.0.2? fredistic --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chovy
2007-Dec-24 18:54 UTC
Re: attachment_fu not saving other attributes (like width, height)
On Dec 24, 3:26 am, fredistic <fredis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When I try to validate height and width in my image model (which is > using attachement_fu) it fails validation. Yet when I examine the > database, those fields are properly filled in. I''ve removed the > validation for now, yet this bothers me. I guess attachment_fu must > have overridden the model save! method but I don''t see where this > happens. Any clues would be appreciated. > > Is there a way to validate that the image processor is installed > correctly? I find that generating thumbnails simply hangs, so I''ve > turned that off while I work on other parts of the project. > > I''m developing on windows xp and rails 2.0.2. Are there any mods or > updates needed for rails 2.0.2? > > fredisticThere is a bug I saw people talk about where you need to add a sleep 1, before you load the picture to your model. Try searching this list for "attachment_fu windows bug" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---