# Attachmnet\_fu can't keep original file image!

**URL:** <https://www.ruby-forum.com/t/attachmnet-fu-cant-keep-original-file-image/163275>\
**Category:** Rails\
**Created:** [March 18, 2009, 9:43pm UTC](https://www.ruby-forum.com/t/attachmnet-fu-cant-keep-original-file-image/163275 "2009-03-18T21:43:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![demec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f05b48/32.png) [@demec](https://www.ruby-forum.com/u/demec)\
**Post date:** [March 18, 2009, 9:43pm UTC](https://www.ruby-forum.com/t/attachmnet-fu-cant-keep-original-file-image/163275/1 "2009-03-18T21:43:34Z")

</div>

I am currently trying to create an application on RoR and I am using  
attachmne\_fu plugin in order to handle image uploads.  
I have also install ImageScience to create some thumbnails for the  
images I upload

The problem is that I can upload images, but it resizes the original  
image to the thumbnail version. I don’t know why.  
For example if I upload an image say IMG\_2455.jpg, in the directory  
0000/0002 I have 2 files:  
a) IMG\_2455.jpg  
b) IMG\_2455\_thumb.jpg

but the original image is also resized! so i have two images of 125x83  
dimensions.  
How can I keep the original image plus the thumbnail version ?  
Here is my code in my model

class Photo \< ActiveRecord::Base

belongs\_to :user

has\_attachment :content\_type =\> :image,  
:storage =\> :file\_system,  
:size =\> 1.byte…12.megabytes,  
:thumbnails =\> { :thumb =\> ‘125x83\>’ },  
:path\_prefix =\> “/public/photos/”

```
validates_as_attachment

```

end

Any suggestions ??

---

<div class="post-metadata">

**Author:** ![demec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f05b48/32.png) [@demec](https://www.ruby-forum.com/u/demec)\
**Post date:** [March 18, 2009, 11:00pm UTC](https://www.ruby-forum.com/t/attachmnet-fu-cant-keep-original-file-image/163275/2 "2009-03-18T23:00:58Z")

</div>

Just out of curiousity, add a

:resize\_to =\> ‘5000x5000\>’,

before the thumbnails option. It _should_ leave any image smaller than  
5000x5000 alone. Obviously, this is an awfully ugly hack, but humor me,  
and see if the presence of the resize\_to option makes a difference.

I use ImageMagick and a

has\_attachment :content\_type =\> [‘image/jpeg’, ‘image/png’],  
:storage =\> :file\_system,  
:max\_size =\> 500.kilobytes,  
:resize\_to =\> ‘1600x1200\>’,  
:thumbnails =\> { :thumb =\> ‘100x100\>’}

to resize any larger image to something that fits full screen on my  
monitor, and the file system has the original, and a thumbnail, both  
properly sized, even when the original is a 1024x768 image. Larger  
images get sized down to 1600x1200.

---

<div class="post-metadata">

**Author:** ![demec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f05b48/32.png) [@demec](https://www.ruby-forum.com/u/demec)\
**Post date:** [March 19, 2009, 5:57am UTC](https://www.ruby-forum.com/t/attachmnet-fu-cant-keep-original-file-image/163275/3 "2009-03-19T05:57:25Z")

</div>

It may have nothing to do with your situation, but I once had a  
similar experince when I forgot to install image magick…

but I think Ar’s advice will probably work

Cheers

Richard,
