Forum: Ruby on Rails Image upload

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
038de4fcd0cd2af9c69d03dd701933ca?d=identicon&s=25 Remy Lopez (Guest)
on 2006-06-02 01:26
ok, im done, the plugins file_column and acts_as_attachment doesnt seems
to work for me, i want a simple thing, upload images, resize it to 216px
width, save its filename to a table and save the file to the
/public/images directory, i have searched a lot but all the examples are
too complex, im starting with rails.

If someone can post a example code for the view, controller and model(if
any) that will be very apreciated, i really have tried without success,
hope someone can help with this.

regards, Remy.
60071e44382435f0f42bf6c3f6e29889?d=identicon&s=25 Scott Holland (ginsberg1982)
on 2006-12-20 15:37
Remy Lopez wrote:
> ok, im done, the plugins file_column and acts_as_attachment doesnt seems
> to work for me, i want a simple thing, upload images, resize it to 216px
> width, save its filename to a table and save the file to the
> /public/images directory, i have searched a lot but all the examples are
> too complex, im starting with rails.
>
> If someone can post a example code for the view, controller and model(if
> any) that will be very apreciated, i really have tried without success,
> hope someone can help with this.
>
> regards, Remy.

Hey, I understand your pain!

I'm leaving this until I have finished building my app and hopefully by
then I will have figured it out.
72f8ab180f81f9c544e2b58da399c0be?d=identicon&s=25 Elad Meidar - Creopolis.com (Guest)
on 2006-12-20 16:53
(Received via mailing list)
Don't crack gentlemen :)

First of all file_column is perfectly fit as your solution. but there
are no good explanations indeed.
send me a mail with your code and i will help you do this.
A1e31c8872289429a3ff1ad497cf4140?d=identicon&s=25 mixplate (Guest)
on 2006-12-20 17:03
acts as attachment is a real simple way to upload images. why does not
it work for you?
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2006-12-21 00:40
(Received via mailing list)
On 20 Dec 2006, at 17:03, mixplate wrote:

> acts as attachment is a real simple way to upload images. why does
> not it work for you?

It worked fine for me until yesterday. As soon as I upload an image
of more than 700 KB and resize it, something goes wrong. The original
large image is kept, stored without a content_type, it's not resized
and no thumbnails were generated. The images are all an original
nikon digital camera shot, the files range from 700-1024 KB.

We've replaced RMagick with MiniMagick, thinking it was somehow
related to memory usage (even though I am still testing on a
PowerBook with 1 GB of RAM, so RAM shouldn't be a problem), but it
wasn't. Just running the mogrify (ImageMagick) command through the
command line resized the image without a problem. Somehow I get a
feeling it's not acts_as_attachment related, but I have no idea where
to look anymore.

And yes, I really need to be able to support resizing very large
images :-)


Best regards

Peter De Berdt
72f8ab180f81f9c544e2b58da399c0be?d=identicon&s=25 Elad Meidar - Creopolis.com (Guest)
on 2006-12-23 11:56
(Received via mailing list)
please paste some code, it's easier to help you in that way.
it's not a Rmagick problem, i resize images sized over 10MB with no
problems
4ca14a2fc9fbbab1b5cf1030e71cba6c?d=identicon&s=25 Paul N (Guest)
on 2006-12-31 18:56
Elad Meidar - Creopolis.com wrote:
> please paste some code, it's easier to help you in that way.
> it's not a Rmagick problem, i resize images sized over 10MB with no
> problems

Elad - I am totally new to rails and I am trying to get file_column to
work.  I got to the point where I can select a file to upload, but then
I get an error
"No action responded to do_image_upload" when I try to upload the file

I assume that is coming from this line in my new.rhtml

<%= form_tag( { :action => 'do_image_upload' }, :multipart => true ) %>

Here is the whole new.rhtml

<h1>New product</h1>

<%= form_tag( { :action => 'do_image_upload' }, :multipart => true ) %>

<%= start_form_tag :action => 'create' %>
  <%= render :partial => 'form' %>
  <%= submit_tag "Create" %>
<%= end_form_tag %>

<%= link_to 'Back', :action => 'list' %>

I figure it is failing when trying to call do_image_upload, but I don't
know what to do there.  Do I have to create the function
do_image_upload?  Any help you can provide would be greatly appreciated.
I have gone to a bunch of sites trying to find this out, but none of the
sites really explain this fully.

Thanks,
Paul
5a903f9189f9e232dead46eb6be1dd19?d=identicon&s=25 kris (Guest)
on 2007-01-01 22:34
(Received via mailing list)
Did you view source on the form? According to the docs, you pass the
":multipart => true" in as a hash, change that and you will be fine. As
for
the image changes with file_column, in your model put, file_column
:some_column, :magick => { :geometry => '100x100' }
72f8ab180f81f9c544e2b58da399c0be?d=identicon&s=25 Elad Meidar (eizesus)
on 2007-01-02 12:23
kris wrote:
> Did you view source on the form? According to the docs, you pass the
> ":multipart => true" in as a hash, change that and you will be fine. As
> for
> the image changes with file_column, in your model put, file_column
> :some_column, :magick => { :geometry => '100x100' }

No action responded? he might coded the multipart definition the wrong
way.
this works for me:

<%= start_form_tag {:action => 'action' }, {:multipart => true } %>
5a903f9189f9e232dead46eb6be1dd19?d=identicon&s=25 kris (Guest)
on 2007-01-03 15:20
(Received via mailing list)
I got the error "No Action Responded" when I didn't setup the multipart
correctly
This topic is locked and can not be replied to.