- Generates and displays a thumbnail image of the size specified by the URL parameter.
- The
Origin
header is checked in the program. This prevents the image generation process from running if the URL is entered directly or embedded from another site without permission. - If a thumbnail image has already been generated (in the case of the second or later requests), the generated image will be displayed instead of processing the generation.
- If the original image has been updated (the file's modified date is newer than the thumbnail image), the generation process will be repeated.
URL Parameters
e.g.
/thumbimage/path/to/sample.jpg?type=webp;w=360;h=240;quality=30
-
The type, width, height, and quality can be specified in the URL parameters.
Image Type URL parameters type
(Required)w
h
quality
AVIF avif
1
-9999
1
-9999
1
-100
(default: 80)WebP webp
JPEG jpeg
PNG png
✘ (ignore) -
The
type
parameter can be singular or multiple. If multiple values are specified, the image will be displayed based on theAccept
request header.Accept
request headertype
parametersResponse image type image/webp,*/* type=avif
AVIF (Cannot be displayed) type[]=avif;type[]=webp;type[]=jpeg
WebP type[]=jpeg;type[]=webp;type[]=avif
WebP image/avif,image/webp,*/* type=avif
AVIF type[]=avif;type[]=webp;type[]=jpeg
AVIF type[]=jpeg;type[]=webp;type[]=avif
AVIF -
If the parameter
w
orh
is larger than the size of the original image, thumbnails will be generated at the size of the original image.Original image size URL parameters Generated image size 1920×1280 w=9999;h=9999
1920×1280 w=9999;h=640
960×640 w=360;h=640
360×240 w=9999
1920×1280 h=640
960×640 (not specified) 1920×1280 - If the value of the parameter is invalid, return
403 Forbidden
. (e.g.?type=xxx;w=10000;h=10000;quality=0
)
Sample
Original file
- Path
- /image/sample.jpg
- Type
- JPEG
- Width
- 1920px
- Height
- 1280px
- Quality
- 80
Generated thumbnail image
Optimal image type selection by using the picture
element
<picture>
<source type="image/avif" srcset="/thumbimage/sample.jpg?type=avif;w=360;quality=30" />
<source type="image/webp" srcset="/thumbimage/sample.jpg?type=webp;w=360;quality=30" />
<img src="/thumbimage/sample.jpg?type=jpeg;w=360;quality=30" alt="Sample Image" crossorigin="" />
</picture>
Optimal image type selection by using the accept
request header
<img src="/thumbimage/sample.jpg?type[]=avif;type[]=webp;type[]=jpeg;w=360;quality=30" alt="Sample Image" crossorigin="" />