Hi,
I need to take a single uploaded image file and save three resized
versions of it, a thumbnail, normal and large version. I was planning
on
doing this in my model by having an array of geometry strings and
looping
through them, each time saving a new image object resized to the correct
geometry. I know that file column does similar stuff, but I would
prefer
to have a separate database row for each image size, rather than one row
and multiple saved files, which is what file_column seems to want to do.
If I store the images as blobs (I use postgresql, so they will be bytea
columns…), is it possible to resize an uploaded image file before
assigning it to the model attribute corresponding to the blob without
writing it to a temp file first? On the other hand, is it better for
performance and maintenance reasons to use files and just save the
location of the image file?
Finally, does anyone have any working code snippet which does these kind
of things using either Magick or preferably, MiniMagick that they can
share, as a starting point?
Sorry for the braindump and flood of questions, but I was hoping people
could save me from spending a lot of time writing something only to
realise that I should have done it another way
Many thanks,
Matt.