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

Watermark with Resize #4

Closed
handelcamilo opened this issue Jan 4, 2017 · 3 comments
Closed

Watermark with Resize #4

handelcamilo opened this issue Jan 4, 2017 · 3 comments

Comments

@handelcamilo
Copy link

Hi, is there a way to add a watermark and resize the image at the same time?
When "image_filter watermark" stands below "image_filter resize", the image cant resize.
When "image_filter resize" stands below "image_filter watermarks", the image dont show the watermark.

Code:
alias /home/ubuntu/SERVER/uploads/$image; image_filter_interlace on; image_filter resize $width -; image_filter_jpeg_quality 75; image_filter_buffer 12M; image_filter watermark /path/logo.png center;

Thank you!
ps: Sorry for bad english.

@TrurlMcByte
Copy link
Collaborator

Just do it in two locations with rewrite

@handelcamilo
Copy link
Author

handelcamilo commented Jan 20, 2017

Please @TrurlMcByte , could you give me an example?
For now, I have two pieces of code where the image is manipulated.

location ~ "^/media/(?\d+)-w/(?.+)$" {
# Proxy to internal image resizing server.
proxy_pass http://localhost:8888/media/$width-w/$image;
proxy_cache images;
proxy_cache_valid 200 30d;
proxy_http_version 1.1;
}

server {
server_name localhost;
listen 8888;

    location ~ "^/media/(?<width>\d+)-w/(?<image>.+)$" {
        alias /home/ubuntu/git/app-gp/CODIGO/SERVER/uploads/$image;
        image_filter resize $width -;
        image_filter_jpeg_quality 75;
        image_filter_buffer 12M;
    }

}

I dont know where I could add the watermark on the resized image :(

Thank you so much!

@TrurlMcByte
Copy link
Collaborator

Use proxy_pass to server itself (or nginx cluster)
For each filter separate location and, if need, proxy_pass to other location to combine filters.
It's nginx image_filter limitation.

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

2 participants