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 Parked at Loopia


Anthony E.
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
}

On Dec 22, 2007 6:43 PM, Anthony E. [email protected] wrote:


| 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

You probably don’t have an image processor installed correctly then.


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

On Dec 22, 4:05 pm, “Rick O.” [email protected] wrote:

I am not getting the thumbnail generated (in db or filesystem), nor
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 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

On Dec 23, 4:15 am, chovy [email protected] wrote:

I am not getting the thumbnail generated (in db or filesystem), nor
I am unclear what I’m doing wrong here.
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.

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

Enclose the image upload in its own form

Sent from my iPhone

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

On Dec 24, 3:26 am, fredistic [email protected] wrote:

I’m developing on windows xp and rails 2.0.2. Are there any mods or
updates needed for rails 2.0.2?

fredistic

There 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”