Forum: Ruby on Rails attachmnet_fu can't keep original file image!

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Demec (Guest)
on 2009-03-18 22:43
(Received via mailing list)
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
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/"



Any suggestions ??
Ar C. (Guest)
on 2009-03-19 00:00
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.
Richard M. (Guest)
on 2009-03-19 06:57
(Received via mailing list)
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


This topic is locked and can not be replied to.