Giter VIP home page Giter VIP logo

caddy-imagefilter's Introduction

Hi there

Stats Card

languages

caddy-imagefilter's People

Contributors

ueffel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

l3dlp-sandbox

caddy-imagefilter's Issues

Have you considered adding watermark to the picture

Have you considered adding watermark to the picture? The watermark content is dynamic. Read the watermark text from the request header

http://:9000 {
	header * {
		-Server
	}
	root D:/Images

	@thumbnail {
		path_regexp thumb /.+\.(jpg|jpeg|png|gif|bmp|tif|tiff|webp)$
	}

	handle @thumbnail {
		image_filter {
			fit {query.w} {query.h}
		}
	}

	file_server
}

http://localhost {
	header * {
		-Server
	}
	root * D:/Images
	route {
		
		reverse_proxy /api/operation/downfile http://localhost:205 {
			@accel header X-Accel-Redirect *
			handle_response @accel {
				rewrite * {rp.header.X-Accel-Redirect}
				header {
					#To realize the download after the file name is changed, add the Content-Disposition at the bottom. 
					#If it is not added, it can realize the authentication before the file acquisition (through the file ID),  Can be used for preview
					Content-Disposition {rp.header.Content-Disposition}
					Water-Mark {rp.header.Water-Mark}
				}
				reverse_proxy [::1]:9000
			}
		}

		try_files {path} /index.html

		file_server
	}
}

#   C# Code if you need I can also provide the go code
#The code returns the true path of the file through the response header. With the watermark to be added, can caddy add the #watermark to the returned image when forwarding to localhost: 9000

# public IActionResult DownFile() {
# 	//If the file does not exist, point to a default picture

# 	//return Redirect("http://localhost:8001/UserFile/notfind.jpg");

# 	//HttpContext.Response.Headers["Content-type"] = "application/octet-stream";
# 	var _fileName = HttpUtility.UrlEncode("imagerealName.jpg");
# 	HttpContext.Response.Headers["Content-Disposition"] = "attachment;filename=" + _fileName;

# 	HttpContext.Response.Headers["X-Accel-Redirect"] = "D:/Images/aaaa.jpg";
#   HttpContext.Response.Headers["Water-Mark"] = "UserRealId";

# 	HttpContext.Response.StatusCode = 200;

# 	return Json("");
# }

need fix Advanced Configuration cache error

I downloaded caddy and image-filter on January 23, 2022 when I used Examples

{
    order image_ filter before file_ server
}

@thumbnail {

    path_ regexp thumb /.+\. (jpg|jpeg|png|gif|bmp|tif|tiff|webp)$

    query w=*

    query h=*

}

image_ filter @thumbnail {

    fit {query.w} {query.h}

}

The code does not respond correctly

Change to the bottom so that you can respond to the request correctly


{
    order image_ filter before file_ server
}

http://localtest.xxx.cn {

    root * D:/GitHub/dist

    route {

        reverse_ proxy /api/* http://192.168.1.123:1205

        try_ files {path} /index.html

        file_ server

   }

   @thumbnail {

        path_ regexp thumb /.+\. (jpg|jpeg|png|gif|bmp|tif|tiff|webp)$

        query w=*

        query h=*

  }


    handle @thumbnail {

    image_ filter {

        fit {query.w} {query.h}

    }

}

Download caddy, image-filter and cache in the introduction again

Error in code in Advanced Configuration after enabling cache

{

order image_ filter before file_ server

order cache before rewrite

}

http://localtest.xxx.cn {

    root * D:/GitHub/dist

    route {

        reverse_ proxy /api/* http://192.168.1.123:1205

        try_ files {path} /index.html

        file_ server

    }

    @thumbnail {

        path_ regexp thumb /.+\. (jpg|jpeg|png|gif|bmp|tif|tiff|webp)$

    }

    handle @thumbnail {

        reverse_ proxy [::1]:9000 # prevents multiple "Server: Caddy" response header

    }

}



http://:9000 { # internal address only accessable from the server itself to transform images

   bind ::1 # local ipv6 address (same as 127.0.0.1 for ipv4)

    #cache {

        #ttl 1000s

    #}



#header Cache-Control "max-age=86400" # keep 1 day in cache

    root D:/GitHub/dist

    @thumbnail {

         path_ regexp thumb /.+\. (jpg|jpeg|png|gif|bmp|tif|tiff|webp)$

    }

    handle @thumbnail {

        image_ filter {

            fit {query.w} {query.h}

        }

    }

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.