# File\_Column w/ Dynamic Sizing

**URL:** <https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067>\
**Category:** Rails\
**Created:** [February 22, 2006, 12:02am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067 "2006-02-22T00:02:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dylan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/34f0e0/32.png) [@Dylan\_S](https://www.ruby-forum.com/u/Dylan_S)\
**Post date:** [February 22, 2006, 12:02am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067/1 "2006-02-22T00:02:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dylan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/34f0e0/32.png) [@Dylan\_S](https://www.ruby-forum.com/u/Dylan_S)\
**Post date:** [February 22, 2006, 12:31am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067/2 "2006-02-22T00:31:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dylan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/34f0e0/32.png) [@Dylan\_S](https://www.ruby-forum.com/u/Dylan_S)\
**Post date:** [February 22, 2006, 12:35am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067/3 "2006-02-22T00:35:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dylan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/34f0e0/32.png) [@Dylan\_S](https://www.ruby-forum.com/u/Dylan_S)\
**Post date:** [February 22, 2006, 4:13am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067/4 "2006-02-22T04:13:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dylan\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/34f0e0/32.png) [@Dylan\_S](https://www.ruby-forum.com/u/Dylan_S)\
**Post date:** [February 22, 2006, 6:40am UTC](https://www.ruby-forum.com/t/file-column-w-dynamic-sizing/54067/5 "2006-02-22T06:40:22Z")

</div>

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