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

How to override 71 megapixel resolution limit? #227

Closed
articulite opened this issue Apr 29, 2020 · 3 comments
Closed

How to override 71 megapixel resolution limit? #227

articulite opened this issue Apr 29, 2020 · 3 comments
Assignees
Labels
completed Feature or request has been completed enhancement New feature or request

Comments

@articulite
Copy link

I'm getting this error.

{"status":"error","code":404,"message":"Image is too large for processing. Width x height should be less than 71 megapixels."}

I've tried building a docker image with modified stream.cpp and thumbnail.cpp files, but when I comment out git clone in the dockerfile to use my modified source this happens:

CMake Error: The source directory "/var/www/imagesweserv" does not appear to contain CMakeLists.txt.

It would be nice if this configuration setting could be easily changed like "weserv_max_size" in imagesweserv.conf. Thanks.

@andrieslouw andrieslouw added enhancement New feature or request triage This issue is being investigated labels Apr 29, 2020
@kleisauke
Copy link
Member

I'll have a look to make this configurable within the nginx module. In the meantime, you could try to change these constants in the cloned repository:

const int MAX_IMAGE_SIZE = 71000000;

const int MAX_TARGET_SIZE = 71000000;

And modify the Dockerfile, like this:

--- a/Dockerfile
+++ b/Dockerfile
@@ -51,8 +51,8 @@ RUN dnf install -y epel-release \
 RUN groupadd nginx \
     && useradd -r -g nginx -s /sbin/nologin -c "Nginx web server" nginx
 
-# Clone the repository
-RUN git clone --recurse-submodules https://github.com/weserv/images.git /var/www/imagesweserv
+# Copy the contents of this repository to the container
+COPY . /var/www/imagesweserv
 
 WORKDIR /var/www/imagesweserv/build

@articulite
Copy link
Author

Ok cool. That worked. :)

@kleisauke kleisauke added completed Feature or request has been completed and removed triage This issue is being investigated labels May 2, 2020
@kleisauke
Copy link
Member

Resolved with b4e8381. These new directives are documented within ngx_conf/README.md. Thanks for the suggestion!

Be careful when setting weserv_limit_input_pixels to 0, do this only for trusted input. There are PNG decompression bombs available that could burn all the available memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed Feature or request has been completed enhancement New feature or request
Development

No branches or pull requests

3 participants