https://github.com/rocketbase-io/imgproxy-java
fluently generate asset urls for img-proxy within java
https://github.com/rocketbase-io/imgproxy-java
fluent imgproxy java
Last synced: 3 months ago
JSON representation
fluently generate asset urls for img-proxy within java
- Host: GitHub
- URL: https://github.com/rocketbase-io/imgproxy-java
- Owner: rocketbase-io
- License: mit
- Created: 2019-11-05T12:38:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-03-26T22:35:37.000Z (3 months ago)
- Last Synced: 2026-03-27T10:40:31.702Z (3 months ago)
- Topics: fluent, imgproxy, java
- Language: Java
- Homepage:
- Size: 46.9 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# imgproxy-java


[](https://mvnrepository.com/artifact/io.rocketbase.asset/imgproxy)
fluently generate asset urls for img-proxy within java
- dependency-free at runtime
- requires Java 11+
- supports signed and unsigned imgproxy URLs
- supports official imgproxy hex key/salt configuration
- supports both encoded and `/plain/` source URLs
## example usage
````java
// unsigned
String url = Signature.of(SignatureConfiguration.unsigned(BASE_URL))
.size(300, 300)
.url(SOURCE_URL)
````
### configuration
````java
// official imgproxy configuration:
// key and salt are the hex-encoded values from IMGPROXY_KEY / IMGPROXY_SALT
SignatureConfiguration signedConfiguration = SignatureConfiguration.signed(
imgproxyProperties.getBaseurl(),
imgproxyProperties.getKey(),
imgproxyProperties.getSalt());
// raw/plain-text fallback:
// only use this if you already have raw key/salt bytes
SignatureConfiguration rawConfiguration = SignatureConfiguration.signedRaw(
imgproxyProperties.getBaseurl(),
keyBytes,
saltBytes);
````
### further usages
````java
String resizedUrl = Signature.of(signedConfiguration)
.resize(ResizeType.fit, 300, 300, true)
.url("s3://bucket-name/" + assetReference.getUrlPath());
// exact 75x75 thumbnail, cropped around the smart focal area
String thumbUrl = Signature.of(signedConfiguration)
.resize(ResizeType.fill, 75, 75, false, false)
.gravity(GravityType.sm)
.url("s3://bucket-name/path/image.jpg", ImageType.webp);
// keep the whole image visible inside 300x300 and fill the remaining area with white
String containUrl = Signature.of(signedConfiguration)
.resize(ResizeType.fit, 300, 300, false, true)
.background("FFFFFF")
.url("s3://bucket-name/path/image.jpg", ImageType.webp);
// useful if you don't want the source URL base64-encoded in the path
String plainUrl = Signature.of(signedConfiguration)
.resize(ResizeType.fit, 1200, 800, true)
.quality(85)
.urlPlain("https://cdn.example.org/images/photo.jpg?version=42", ImageType.jpg);
````