Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size restrictions are not properly applied to separate thumbnail class. #6

Open
eviltwin opened this issue Nov 1, 2009 · 0 comments

Comments

@eviltwin
Copy link

eviltwin commented Nov 1, 2009

I have two classes, one which manages the "child" images and one for the "parent" images.

In the parent image class I have:
class Photo < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:size => 1..5.megabytes,
:thumbnails => { :thumb => 'c100x100' },
:thumbnail_class => ChildPhoto,
:path_prefix => "Photos"

  validates_as_attachment
end

And in the child class:
class ChildPhoto < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:path_prefix => "Photos",

  validates_as_attachment
end

I've removed the :belongs_to stuff because mine is quite funky and gets in the way of reading :)

Anyways, this is code for a friend's photography portfolio and so obviously the images can be quite large when first uploaded. The issue, though, is that I left the size parameter as the default for the child class as I figured thumbnails wouldn't be very large at all. However, the image size is checked before the resize operation and so the child class throws its toys out of the pram because it has an image that is larger than it is expecting. Is this expected behavior? The solution, obviously, is to also apply the :size option to the ChildImage class, but this feels wrong to me...

j1wilmot pushed a commit to Punchbowl/attachment_fu that referenced this issue Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant