image upload

1 view
Skip to first unread message

ravenna

unread,
Mar 16, 2009, 7:58:38 PM3/16/09
to PeepCode
I am setting up a basic rental properties cms and I need to have the
admin be able to upload images using a form. What is the best way to
have an image1:string field be able to have an "upload" button...

I am brand new to rails.. any help is greatly appreciated.

thanks

TJ

Rishav Rastogi

unread,
Mar 17, 2009, 3:20:13 PM3/17/09
to peep...@googlegroups.com
you can use attachment_fu plugin

refer to following blog posts for details

http://www.clarkware.com/cgi/blosxom/2007/02/24

HTH

Cheers
Rishav

Geoffrey Grosenbach

unread,
Mar 17, 2009, 6:53:15 PM3/17/09
to PeepCode
On Mar 16, 4:58 pm, ravenna <t...@ravennainteractive.com> wrote:
> I am setting up a basic rental properties cms and I need to have the
> admin be able to upload images using a form.  What is the best way to
> have an image1:string  field be able to have an "upload" button...

You shouldn't store an image in a string field. Use a blob field.

Bette yet, if you expect to store many photos, it's best to store them
on disk. The public/system directory that will be retained by
Capistrano between deployments is a good place (and backup regularly).

In addition to attachment_fu, Paperclip is also a popular plugin:

http://thoughtbot.com/projects/paperclip

It will be easier if you can count on the client to resize the photo
to the proper dimensions. Otherwise, you'll need to install RMagick,
ImageScience, or similar to resize the photograph after it's been
uploaded.

Finally, I frequently forget to make the submitting form
multipart...it won't work without that.

Geoffrey Grosenbach
http://peepcode.com

Reply all
Reply to author
Forward
0 new messages