Comments (4)
Not sure if there's a global config option in MiniMagick to set this kind of stuff. There isn't anything in Refile at least.
from refile-mini_magick.
If your VPS has certain memory/disk limits, it seems reasonable for me to set it per-VPS, that is, in the policy.xml file. Is there a reason why you would want to set it per-application/attribute?
I think there is no pretty way to add it to Refile. I was thinking we could write the processing methods like this:
def fit(img, width, height)
img.combine_options do |cmd|
# ...
yield cmd if block_given?
# ...
end
end
And then you could override that method with
Refile::MiniMagick.prepend Module.new {
def fit(img, width, height) do
super do |cmd|
cmd.limit "memory", "400MiB"
cmd.limit "map", "400MiB"
cmd.limit "disk", "1MiB"
end
end
}
from refile-mini_magick.
Part of the problem is, as far as I can tell, policy.xml isn't multi-instance aware. If I have 8 files being thumbnailed (which I very well could, from a single page render, depending on browser setup) the memory preferences would be much lower per file than they would be if I could force them to process serially.
from refile-mini_magick.
In #1 there was a similar request to make Refile::MiniMagick
extendable using a dedicated API, but in #1 (comment) I explained why I don't think it would be a good idea. However, I will probably add an (undocumented) yield I proposed above, hopefully it should be good enough for both cases.
from refile-mini_magick.
Related Issues (15)
- Add support for image auto-orientation HOT 9
- Losing Alpha channel HOT 8
- Pad should scale image like `fit`, not like `limit`
- The actions are destructive HOT 2
- Moving forward to v1.0 HOT 4
- Sinatra 2.0 HOT 2
- cant install gem if adding 'gem 'refile-mini_magick'' HOT 2
- 1.2 ImageProcessing gem HOT 1
- Rack dependency needs to be updated to >= 2.0 HOT 2
- Set image quality via options HOT 1
- Release gem HOT 1
- gem 'refile-mini_magick' is not found HOT 4
- Video? HOT 1
- Is there support for multiple processors? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refile-mini_magick.