Depot App: Upload Images

Hello,

I’m a newbie to Ruby on Rails and like many others, I have been working
through the depot application in the Agile Web D. book.

I was wondering if anyone had enhanced the depot application to include
the upload of images for each product? The following describes the sort
of thing that I have been asked to produce for a client, so apologies if
the information is not articulated very well.

I would like to upload a main image that would automatically create a
thumbnail sized to 400px by 400px. And then to also upload a number of
supplementary images that would automatically create thumbnail images of
size 200px by 200px and then obviously to be able to click on these to
view the larger images using some fancy ajax.

If anyone has any samples of code that they would be willing to share,
then that would be great. :slight_smile:

Thanks,
Neil.

Actually, I think I may have found a solution with the File Column
field:
http://wiki.rubyonrails.org/rails/pages/File+Column+Plugin

Neil B. wrote:

Hello,

I’m a newbie to Ruby on Rails and like many others, I have been working
through the depot application in the Agile Web D. book.

I was wondering if anyone had enhanced the depot application to include
the upload of images for each product? The following describes the sort
of thing that I have been asked to produce for a client, so apologies if
the information is not articulated very well.

I would like to upload a main image that would automatically create a
thumbnail sized to 400px by 400px. And then to also upload a number of
supplementary images that would automatically create thumbnail images of
size 200px by 200px and then obviously to be able to click on these to
view the larger images using some fancy ajax.

If anyone has any samples of code that they would be willing to share,
then that would be great. :slight_smile:

Thanks,
Neil.

Super Image works well too.

http://plugins.radrails.org/directory/show/33

Thanks for the link Alex.

I’m trying to determine whether it would be best to upload images into
the database or not.

The client who I am creating an online shop for is fairly knowledgable
with Photoshop and so he will probably just upload the images at the
correct sizes.

I have opted to go for the FileColumn technique. Does anyone know if
there would be any change to the code (
http://www.kanthak.net/opensource/file_column/ ) so that I can signify
an image as the ‘main product photo’ or as a ‘secondary photo’ ?

The client wishes to upload a main product photo, then a small gallery
(search listings) photo, plus upto 5 secondary photos.

Grateful for any assistance.

Thanks,
Neil.

Neil B. wrote:

Thanks for the link Alex.

I’m trying to determine whether it would be best to upload images into
the database or not.

The client who I am creating an online shop for is fairly knowledgable
with Photoshop and so he will probably just upload the images at the
correct sizes.

I have opted to go for the FileColumn technique. Does anyone know if
there would be any change to the code (
http://www.kanthak.net/opensource/file_column/ ) so that I can signify
an image as the ‘main product photo’ or as a ‘secondary photo’ ?

The client wishes to upload a main product photo, then a small gallery
(search listings) photo, plus upto 5 secondary photos.

Grateful for any assistance.

Thanks,
Neil.

What I have done (using superimage but the principle is identical), is
the first image is simply the “main” image. So Product has_many
:images, and Image has a field called position. This way the first
image is always the “main” image. and if Image acts_as_list it should
be easy to change the order of the images and select a new main image
simply by making it first.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs