Comments (3)
Hey @diegoatpitch!
Could you provide a use case for this feature?
from imgproxy.
The main use case is to reduce our CDN billing in a single shot.
Image sizes are calculated dynamically and on the client side. Sometimes we have some unnecessarily large images being requested.
We also are in a unique situation where we can't force all users to newer versions of the software, so adding this limit to client side would take at least 6 months to reach 90% of all of our requests.
Since this would be a server side configuration option it would help mitigate possible DoS attacks on instances without signature. I know this is not the ideal security scenario, but for us would help a great deal with mitigation.
from imgproxy.
We received a similar request some time ago. We didn't move forward with it because it does not actually prevent DoS attacks: imgproxy has a few processing options besides width and height that can be used for DoS.
We were in the same situation as you when developing our website. We have a demo on our website that allows you to resize an image and apply filters dynamically, thus we can't rely on pre-generated URLs. So we made an API that generates and signs imgproxy URLs based on the provided options. That API also checks the provided options so they match the restrictions. I would offer you to use the same approach.
Since we need to show the imgproxy URL on our site, our API just returns the URL, but you can make it to make a redirect. The API is very simple and responds in a millisecond while running on the smallest GCR instance.
The difference between our cases is that our API requires width and height to be provided while in your case, as far as I understood, it is not required. In this case, I'd offer to use a default preset: default=width:8000/height:8000
. This should work because of two things:
- The
default
preset is always applied before the processing options from the URL. - When the
enlarge
option is not used, imgproxy doesn't enlarge images, so thewidth
andheight
options here will be treated as "maximum width" andmaximum height
. Of course, these options can be overwritten by the URL, but your API will take care of this.
The API is so simple that I could build a draft of it with a language I am familiar with if you like.
from imgproxy.
Related Issues (20)
- Base64 encoding of local url doesn't work HOT 1
- Resizing with "fit" mode leads to blurry images in some cases HOT 2
- invalid TIFF format: image dimensions are not specified HOT 6
- Support EPS files HOT 1
- "is not a video" error when trying to source PSD file HOT 2
- How to get width and height of original img? HOT 1
- Feature request: support using data urls as watermarkurl HOT 1
- Feature request: Gradient improvements HOT 5
- Text is illegible when a PDF has non-embedded CID TrueType and no character map HOT 4
- Error: heifsave: image too large HOT 2
- Using imgproxy via Proxy for Amazon S3 HOT 3
- Option to report source image errors HOT 4
- Style transformation for SVG broken since 3.23 HOT 3
- Error: SVG detection does not work when it uses namespaces HOT 2
- Can't download source image: invalid JPEG format: missing SOF marker HOT 2
- ERROR png2vips: unable to read source source HOT 2
- Produces invalid SVG when namespaced attributes appear before namespace declaration HOT 1
- Support for external IDs when using S3 with assumed roles HOT 3
- Error: store of inconsistently typed value into Value HOT 1
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 imgproxy.