mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-03 10:43:58 +02:00
Add "Copy to clipboard" buttons to code blocks in docs
This commit is contained in:
parent
9b39b467cb
commit
a16a268ae7
@ -7,8 +7,8 @@ This guide will show you how to get your first image resized with imgproxy quick
|
|||||||
Let's assume you have Docker installed on your machine. Then you can pull an official imgproxy image, and you're done!
|
Let's assume you have Docker installed on your machine. Then you can pull an official imgproxy image, and you're done!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker pull darthsim/imgproxy:latest
|
docker pull darthsim/imgproxy:latest
|
||||||
$ docker run -p 8080:8080 -it darthsim/imgproxy
|
docker run -p 8080:8080 -it darthsim/imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't have docker, you can use Heroku for a quick start.
|
If you don't have docker, you can use Heroku for a quick start.
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
--sidebar-background: var(--mono-shade4);
|
--sidebar-background: var(--mono-shade4);
|
||||||
--sidebar-border-color: hsla(0,0%,100%,.4);
|
--sidebar-border-color: hsla(0,0%,100%,.4);
|
||||||
|
|
||||||
|
--copycode-background: var(--link-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
@ -15,13 +15,13 @@ You can specify multiple key/salt pairs by dividing keys and salts with comma (`
|
|||||||
You can also specify paths to files with a hex-encoded keys and salts, one by line (useful in a development environment):
|
You can also specify paths to files with a hex-encoded keys and salts, one by line (useful in a development environment):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ imgproxy -keypath /path/to/file/with/key -saltpath /path/to/file/with/salt
|
imgproxy -keypath /path/to/file/with/key -saltpath /path/to/file/with/salt
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
|
If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
||||||
```
|
```
|
||||||
|
|
||||||
## Server
|
## Server
|
||||||
@ -140,7 +140,7 @@ There are two ways to define presets:
|
|||||||
#### Using a command line argument
|
#### Using a command line argument
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ imgproxy -presets /path/to/file/with/presets
|
imgproxy -presets /path/to/file/with/presets
|
||||||
```
|
```
|
||||||
|
|
||||||
The file should contain preset definitions, one per line. Lines starting with `#` are treated as comments. Example:
|
The file should contain preset definitions, one per line. Lines starting with `#` are treated as comments. Example:
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
|
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
|
||||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||||
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
||||||
|
<script src="https://unpkg.com/docsify-copy-code@2"></script>
|
||||||
<link href="https://fonts.googleapis.com/css?family=Fira+Mono|Roboto:400,700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Fira+Mono|Roboto:400,700&display=swap" rel="stylesheet">
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,15 +7,15 @@ There are four ways you can install imgproxy:
|
|||||||
imgproxy can (and should) be used as a standalone application inside a Docker container. Just pull the official image from Docker Hub:
|
imgproxy can (and should) be used as a standalone application inside a Docker container. Just pull the official image from Docker Hub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker pull darthsim/imgproxy:latest
|
docker pull darthsim/imgproxy:latest
|
||||||
$ docker run -p 8080:8080 -it darthsim/imgproxy
|
docker run -p 8080:8080 -it darthsim/imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also build your own image. imgproxy is ready to be dockerized, plug and play:
|
You can also build your own image. imgproxy is ready to be dockerized, plug and play:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker build -t imgproxy .
|
docker build -t imgproxy .
|
||||||
$ docker run -p 8080:8080 -it imgproxy
|
docker run -p 8080:8080 -it imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
## Heroku
|
## Heroku
|
||||||
@ -27,10 +27,10 @@ imgproxy can be deployed to Heroku with a click of a button:
|
|||||||
However, you can do it manually with a few steps:
|
However, you can do it manually with a few steps:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git clone https://github.com/imgproxy/imgproxy.git && cd imgproxy
|
git clone https://github.com/imgproxy/imgproxy.git && cd imgproxy
|
||||||
$ heroku create your-application
|
heroku create your-application
|
||||||
$ heroku stack:set container
|
heroku stack:set container
|
||||||
$ git push heroku master
|
git push heroku master
|
||||||
```
|
```
|
||||||
|
|
||||||
## Packages
|
## Packages
|
||||||
@ -48,9 +48,9 @@ First, install [libvips](https://github.com/libvips/libvips).
|
|||||||
Ubuntu apt repository contains a pretty old version of libvips. You can use PPA with more recent version of libvips:
|
Ubuntu apt repository contains a pretty old version of libvips. You can use PPA with more recent version of libvips:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo add-apt-repository ppa:dhor/myway
|
sudo add-apt-repository ppa:dhor/myway
|
||||||
$ sudo apt-get update
|
sudo apt-get update
|
||||||
$ sudo apt-get install libvips-dev
|
sudo apt-get install libvips-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
But if you want to use all the features of imgproxy, it's recommended to build libvips from the source: [https://github.com/libvips/ libvips/wiki/Build-for-Ubuntu](https://github.com/libvips/libvips/wiki/Build-for-Ubuntu)
|
But if you want to use all the features of imgproxy, it's recommended to build libvips from the source: [https://github.com/libvips/ libvips/wiki/Build-for-Ubuntu](https://github.com/libvips/libvips/wiki/Build-for-Ubuntu)
|
||||||
@ -58,22 +58,22 @@ But if you want to use all the features of imgproxy, it's recommended to build l
|
|||||||
Next, install the latest Go:
|
Next, install the latest Go:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo add-apt-repository ppa:longsleep/golang-backports
|
sudo add-apt-repository ppa:longsleep/golang-backports
|
||||||
$ sudo apt-get update
|
sudo apt-get update
|
||||||
$ sudo apt-get install golang-go
|
sudo apt-get install golang-go
|
||||||
```
|
```
|
||||||
|
|
||||||
And finally, install imgproxy itself:
|
And finally, install imgproxy itself:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ CGO_LDFLAGS_ALLOW="-s|-w" go get -f -u github.com/imgproxy/imgproxy
|
CGO_LDFLAGS_ALLOW="-s|-w" go get -f -u github.com/imgproxy/imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
### macOS + Homebrew
|
### macOS + Homebrew
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ brew install vips go
|
brew install vips go
|
||||||
$ PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \
|
PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \
|
||||||
CGO_LDFLAGS_ALLOW="-s|-w" \
|
CGO_LDFLAGS_ALLOW="-s|-w" \
|
||||||
CGO_CFLAGS_ALLOW="-Xpreprocessor" \
|
CGO_CFLAGS_ALLOW="-Xpreprocessor" \
|
||||||
go get -f -u github.com/imgproxy/imgproxy
|
go get -f -u github.com/imgproxy/imgproxy
|
||||||
|
@ -23,7 +23,7 @@ There are three ways to specify your AWS credentials. The credentials need to ha
|
|||||||
You can specify AWS Acces Key ID and Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
|
You can specify AWS Acces Key ID and Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
|
AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
|
||||||
|
|
||||||
# same for Docker
|
# same for Docker
|
||||||
docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it darthsim/imgproxy
|
docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it darthsim/imgproxy
|
||||||
|
@ -10,7 +10,7 @@ imgproxy can be configured to process files from your local filesystem. To use t
|
|||||||
Assume you want to process an image that stored locally at `/path/to/project/images/logos/evil_martians.png`. Run imgproxy with `IMGPROXY_LOCAL_FILESYSTEM_ROOT` set to your images directory:
|
Assume you want to process an image that stored locally at `/path/to/project/images/logos/evil_martians.png`. Run imgproxy with `IMGPROXY_LOCAL_FILESYSTEM_ROOT` set to your images directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ IMGPROXY_LOCAL_FILESYSTEM_ROOT=/path/to/project/images imgproxy
|
IMGPROXY_LOCAL_FILESYSTEM_ROOT=/path/to/project/images imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
Then use path inside this directory as the source URL:
|
Then use path inside this directory as the source URL:
|
||||||
|
@ -14,7 +14,7 @@ Read our [Configuration](configuration.md#url-signature) guide to find more ways
|
|||||||
If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
|
If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
|
||||||
```
|
```
|
||||||
|
|
||||||
### Calculating URL signature
|
### Calculating URL signature
|
||||||
@ -43,7 +43,7 @@ http://imgproxy.example.com/insecure/fill/300/400/sm/0/aHR0cDovL2V4YW1w/bGUuY29t
|
|||||||
To sign it, you need to configure imgproxy to use your key/salt pair. Let's say, your key and salt are `secret` and `hello` — that translates to `736563726574` and `68656C6C6F` in hex encoding. This key/salt pair is quite weak for production use but will do for this example. Run your imgproxy using this key/salt pair:
|
To sign it, you need to configure imgproxy to use your key/salt pair. Let's say, your key and salt are `secret` and `hello` — that translates to `736563726574` and `68656C6C6F` in hex encoding. This key/salt pair is quite weak for production use but will do for this example. Run your imgproxy using this key/salt pair:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy
|
IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that all your unsigned URL will stop working since imgproxy now checks signatures of all URLs.
|
Note that all your unsigned URL will stop working since imgproxy now checks signatures of all URLs.
|
||||||
|
@ -6,9 +6,12 @@ imgproxy supports watermarking processed images with another image.
|
|||||||
|
|
||||||
There are three ways to specify a watermark image using environment variables:
|
There are three ways to specify a watermark image using environment variables:
|
||||||
|
|
||||||
* `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.webp | tr -d '\n'`.
|
|
||||||
* `IMGPROXY_WATERMARK_PATH`: path to the locally stored image.
|
* `IMGPROXY_WATERMARK_PATH`: path to the locally stored image.
|
||||||
* `IMGPROXY_WATERMARK_URL`: watermark image URL.
|
* `IMGPROXY_WATERMARK_URL`: watermark image URL.
|
||||||
|
* `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with the following snippet:
|
||||||
|
```bash
|
||||||
|
base64 tmp/watermark.webp | tr -d '\n'`.
|
||||||
|
```
|
||||||
|
|
||||||
You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.
|
You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user