feat: add fullpage and maxheight parameters for enhanced screenshot options
All checks were successful
Build Container / docker (push) Successful in 4m13s
All checks were successful
Build Container / docker (push) Successful in 4m13s
This commit is contained in:
37
README.md
37
README.md
@@ -28,18 +28,41 @@ Whenever you come to this page you can just [download](https://github.com/chrisi
|
||||
|
||||
## Usage
|
||||
|
||||
After you extracted the contents of this repo to your webserver and can access the page and it will tell you how to use the API.
|
||||
|
||||
But it's as simple as:
|
||||
|
||||
```
|
||||
https://your-url-and.path/api.php?[OPTIONS]&url=[WEBSITE_URL]
|
||||
https://your-host/api?url=[WEBSITE_URL]&[OPTIONS]
|
||||
```
|
||||
|
||||
The requested page will render as image (not provide a link). So you can use the path to your api.php file like so:
|
||||
### Parameters
|
||||
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `url` | — | Target URL to screenshot (required) |
|
||||
| `viewport` | `1024x768` | Viewport size as `WIDTHxHEIGHT` (max 3840x2160) |
|
||||
| `js` | `true` | Enable JavaScript (`true`/`false`) |
|
||||
| `fullpage` | `false` | Capture full page height instead of viewport only |
|
||||
| `maxheight` | `15000` | Max pixel height for full-page captures (1–30000) |
|
||||
| `key` | — | API key (if `API_KEY` env var is set) |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Standard viewport screenshot
|
||||
curl "https://your-host/api?url=https://example.com" -o screenshot.png
|
||||
|
||||
# Full-page screenshot (great for LLM analysis)
|
||||
curl "https://your-host/api?url=https://example.com&fullpage=true" -o full.png
|
||||
|
||||
# Full-page with custom width and height cap
|
||||
curl "https://your-host/api?url=https://example.com&fullpage=true&viewport=1280x768&maxheight=20000" -o full.png
|
||||
|
||||
# With API key
|
||||
curl -H "X-API-Key: your-secret" "https://your-host/api?url=https://example.com&fullpage=true" -o full.png
|
||||
```
|
||||
|
||||
Use as an `<img>` src:
|
||||
|
||||
```html
|
||||
<img src="https://your-url-and.path/api.php?url=http://xkcd.com" title="screenshot of xkcd.com" />
|
||||
<img src="https://your-host/api?url=https://example.com" title="screenshot" />
|
||||
```
|
||||
|
||||
### Example php script to proxy an image to the local server
|
||||
|
||||
Reference in New Issue
Block a user