I didn''t write file_column, that belongs to Sebastian Kanthak. I
wrote a couple of extensions to file_column for validation, and image
handling.
That said, file_column can handle whatever relations you throw at it.
You may have to make a separate images table, consisting of the
file_column and a primary key, and link to it using standard has_many
and HABTM relationships.
file_column doesn''t give you dynamic thumbnailing, although extensions
I wrote do give you multiple static thumbnails on_create
Kyle Maxwell
On 10/4/05, Adam Roth <adamjroth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hey Kyle,
>
> I''m aware that you''ve written file_column, and
I''ve seen you chime-in in a
> few threads regarding file uploads and images. I figured I would finally
> email you and inform you of the reasons I don''t use file column
and with
> that, let you know exactly how I''m managing images on my site.
Maybe we can
> then come up with a common solution.
>
> I''m building a community site in which various models can have
multiple
> pictures:
>
> profiles
> products
> blogs
>
> I am using a HABTM relationship. Ie:
>
> tables:
> profiles (has a ''default_picture_id'' column)
> products (has a ''default_picture_id'' column)
> blogs (has a ''default_picture_id'' column)
>
> pictures
> thumbnails (i''d rather generate thumbnails dynamically and
cache as
> necessary, but the ImageMagick tag helper wasn''t exactly what I
was looking
> for... and required more work than it was worth to make pretty URLs.)
>
> blogs_pictures
> products_pictures
> profiles_pictures
>
>
> From each model edit page (profile, product)... you can then click to
''Edit
> Pictures'' to upload, set the default_picture_id for the model,
destroy,
> etc....
>
> On upload, I create N thumbnails based on the model (size data stored in
> config files).
>
> def upload
> ...
> ## Find the correct object based on the URL, and add the picture...
> @object = eval( @params[:object].capitalize ).find( @params[:object_id)
)
> @object.add_pictures( @picture )
> ...
> end
>
> Can file_column handle a situation such as this? If I made it seem to
> complex, it''s really just a case of wanting to be able to add N
pictures to
> N models as easily as possible.
>
> Best
> Adam Roth
>
>