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

Conditional versions checking everytime uploader called? #2132

Closed
adysson opened this issue Mar 3, 2017 · 4 comments
Closed

Conditional versions checking everytime uploader called? #2132

adysson opened this issue Mar 3, 2017 · 4 comments

Comments

@adysson
Copy link

adysson commented Mar 3, 2017

Hi,
after update of Carrierwave from 0.6.2 to 1.0.0, our app started to be painfully slow.
We use conditional versions in an uploader i.e. Object#logo. By method is_big_enough?, it checks source image resolution (using mini_magick gem) before versions :medium and :large are created - to prevent increasing of image resolution i.e. from 200x200px to 400x400px.
There are other versions without conditionals: :small and :semi_small
In Carrierwave v. 0.6.2, if I call object.logo.small.url, conditional method is_big_enough? is not called.
In Carrierwave v. 1.0.0, conditional method is_big_enough? seems to be called everytime.

In a big page with 100+ calls to various instances of the uploader, loading of page starts to be painfully slow, because is_big_enough? uses mini_magick which touches HDD/SDD.

Is this desired behavior because of some reason or it happens by mistake?
Thank you

@francisneedham
Copy link

same problem here

@marcek
Copy link

marcek commented May 13, 2022

Have the same problem currently using version 2.2.2

@jasonfine
Copy link

Bumping, this needs input from the authors.

@mshibuya
Copy link
Member

The change itself came from #1351, but makes some sense.
So what I recommend is to get dimensions of the file and store it in some model columns on processing, so the dimensions can be checked with little overhead later.

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

5 participants