File_Column w/ Dynamic Sizing

I’m running file_column 0.3.1, and having a few problems… which are:

  • Uploading a 378x567 jpg, and using :magick => {:geometry =>
    “100x100” }, my image ends up being 67x100 ?
    Is there a way to “force” the image to be the size you specify ?

  • My view has a drop-down of sizes, and I’m trying to pass in this
    size into :magick => {:geometry => SIZE_HERE}.
    I’ve tried replacing SIZE_HERE with self.size, replacing it with a
    @size instance variable in a “before_create”… etc, etc…
    … but I can’t seem to get the proper value included in this hash
    prior to it running.

Any insight into the above would be great,
Thank you !

Dylan

Dylan,
Although you’re setting 100x100, the image proportions are being
constrained which is a good thing believe it or not. If the Proportions
weren’t then the image would come out looking squished and stretched. I
don’t believe anything exists that would be able to programmatically
change the image size without constraint to the proportions and still
have it looking good but I could be wrong. If their is, the best you
could hope for is that the image would be changed to 67X100 but
incorporated into another image that was 100X100. The result would be
white (or what ever color you chose) on either side.

Sorry, it may not be the answer you were looking for but at least your
on your way.

Scott.

Dylan S. wrote:

I’m running file_column 0.3.1, and having a few problems… which are:

  • Uploading a 378x567 jpg, and using :magick => {:geometry =>
    “100x100” }, my image ends up being 67x100 ?
    Is there a way to “force” the image to be the size you specify ?

  • My view has a drop-down of sizes, and I’m trying to pass in this
    size into :magick => {:geometry => SIZE_HERE}.
    I’ve tried replacing SIZE_HERE with self.size, replacing it with a
    @size instance variable in a “before_create”… etc, etc…
    … but I can’t seem to get the proper value included in this hash
    prior to it running.

Any insight into the above would be great,
Thank you !

Dylan

Gotcha… thanks for the explanation Scott.
This definitely makes sense, and actually makes my work a little bit
easier.
Thanks again !

i believe you can specify a forced sized by appending a ‘!’ such as
:magick => {:geometry => “100x100!” }

if you look in the rmagick docs under ‘geometry strings’ there are all
sorts of extras like ‘<’ to resize if it is smaller than the given size.

-felix

ahh… brilliant, thanks Felix. the RMagick docs are huuuuge, and I
probably skipped right over this :frowning:
there are about 100 instance methods for Image itself… and they are
all
actually very applicable :slight_smile: