Skip to content

Options

Each imgproxy processing option is a class in the SomehowDigital\ImgProxy\Option namespace. Every class has its own page with a usage example, its parameters and notes.

Options marked Pro need imgproxy Pro. See imgproxy Pro for what that means in practice.

Every option implements OptionInterface:

interface OptionInterface
{
public function getName(): string;
public function getAlias(): ?string;
public function getValues(): array;
public function getParameters(): array;
}

getParameters() returns the URL parameters as strings: booleans become 1 or 0, enums their value, and nested options their parameters. The URL uses getAlias() when there is one, and getName() otherwise. To add your own option, see Extending.

Sizing

ClassimgproxyDescription
AutoRotatearApplies the EXIF orientation of the source and removes the tag.
DprdprMultiplies the resulting dimensions by a device pixel ratio, for HiDPI screens.
EnlargeelAllows enlarging images that are smaller than the requested size.
ExtendexExtends the image to the requested size when it is smaller, filling the new area with the background color.
ExtendAspectRatioexarExtends the image to the requested aspect ratio, filling the new area with the background color.
FlipflFlips the image horizontally, vertically or both.
HeighthSets the height of the resulting image.
MaxResultDimensionmrdLimits the larger dimension of the resulting image.
MinHeightmhSets the minimum height of the resulting image.
MinWidthmwSets the minimum width of the resulting image.
PaddingpdAdds padding around the image, after all other transformations.
ResizersSets the resizing type, size, enlarge and extend behavior in a single option.
ResizingAlgorithm ProraSets the algorithm used to resample the image.
ResizingTypertDefines how the image is fitted to the requested size.
RotaterotRotates the image clockwise by a multiple of 90 degrees.
SizesSets width, height, enlarge and extend in a single option.
TrimtRemoves the surrounding background from the image.
WidthwSets the width of the resulting image.
ZoomzMultiplies the resulting dimensions.

Cropping

ClassimgproxyDescription
CropcCrops the image to a size before it is resized.
CropAspectRatio ProcarAdjusts the crop area to an aspect ratio.
CropObjects Proc_objCrops the image to the objects detected by imgproxy’s object detection.
Gravity Partly ProgSets the anchor for cropping and extending.
GravityFocusPointgGravity on a focus point given in relative coordinates.
GravityObject ProgGravity on the objects of the given classes, as detected by imgproxy’s object detection.
GravityObjectWeight ProgGravity on detected objects, with a weight for each class.
GravitySmartgGravity on the most interesting part of the image, as detected by imgproxy.
ObjectsPosition ProopPositions the detected objects within the resulting image.

Effects

ClassimgproxyDescription
Adjust ProaSets brightness, contrast and saturation in one option.
BackgroundbgFills transparent areas and padding with a color.
BackgroundAlpha ProbgaAdds an alpha channel to the background color.
BlurblApplies a gaussian blur.
BlurAreas ProbaBlurs rectangular areas of the image.
BlurDetections ProbdBlurs the objects found by imgproxy’s object detection.
Brightness ProbrAdjusts the brightness of the image.
Colorize ProcolOverlays a color on the image.
Contrast ProcoAdjusts the contrast of the image.
DrawDetections ProddDraws boxes, classes and confidences of detected objects onto the image.
Duotone ProdtConverts the image to two tones, mapping dark and light areas to two colors.
Gradient ProgrOverlays a gradient that fades from transparent to a color.
Monochrome PromcConverts the image to monochrome.
PixelatepixApplies a pixelation filter.
Saturation ProsaAdjusts the saturation of the image.
SharpenshApplies a sharpening filter.
UnsharpMasking ProushApplies unsharp masking.

Output

ClassimgproxyDescription
AutoQuality ProaqPicks the quality automatically by encoding the image several times.
AvifOptions ProavifoSets AVIF encoder options.
ColorProfile ProcpConverts the image to a color profile and embeds it.
DisableAnimation ProdaTreats animated images as static, using the first frame.
Dpi ProdpiReplaces the DPI metadata of the image.
EnforceThumbnailethUses the thumbnail embedded in the source, when there is one.
FilenamefnSets the file name used in the Content-Disposition header.
Format Partly ProfSets the output format as a processing option.
FormatQualityfqSets the quality for individual output formats.
JpegOptions ProjpgoSets JPEG encoder options.
KeepCopyrightkcrKeeps the copyright information when metadata is stripped.
MaxBytesmbLowers the quality until the result fits in a number of bytes.
PngOptions PropngoSets PNG encoder options.
PreserveHdrphKeeps the high bit depth of HDR images instead of reducing them to 8 bits.
QualityqSets the quality of the resulting image.
RawrawStreams the source as it is, without processing or checks.
ReturnAttachmentattMakes imgproxy answer with a Content-Disposition: attachment header, so browsers download the file.
SkipProcessingskpSkips processing for sources of the given formats, when the result would keep the source format.
StripColorProfilescpConverts the image to sRGB and removes its color profile.
StripMetadatasmRemoves metadata, such as EXIF and IPTC, from the result.
WebpOptions ProwebpoSets WebP encoder options.

Source

ClassimgproxyDescription
FallbackImageUrl ProfiuSets an image that is served when the source cannot be loaded.
Hashsum ProhsVerifies the checksum of the source.
MaxAnimationFrameResolutionmafrLimits the resolution of a single frame of animated sources.
MaxAnimationFramesmafLimits the number of frames of animated sources.
MaxSourceFileSizemsfsLimits the file size of the source.
MaxSourceResolutionmsrLimits the resolution of the source.
Page PropgSelects the page or frame of a multi-page or animated source.
Pages PropgsSets the number of pages that are stacked vertically in the result.
Style ProstInjects CSS into SVG sources.
VideoThumbnailAnimation ProvtaGenerates an animation from video frames.
VideoThumbnailKeyframes ProvtkRestricts video thumbnails to keyframes.
VideoThumbnailSecond ProvtsSets the second of a video that is used for the thumbnail.
VideoThumbnailTile ProvttGenerates a sprite of video thumbnails.

Watermark

ClassimgproxyDescription
Watermark Partly ProwmPlaces the watermark that is configured in imgproxy on the image.
WatermarkRotate ProwmrRotates the watermark clockwise.
WatermarkShadow ProwmshAdds a shadow to the watermark.
WatermarkSize ProwmsSets the size of the watermark.
WatermarkText ProwmtRenders a text as the watermark.
WatermarkUrl ProwmuSets the image that is used as the watermark.

Delivery

ClassimgproxyDescription
CacheBustercbAdds a value to the URL that has no effect on processing, so caches treat the result as a new resource.
ExpiresexpMakes the URL expire.
PresetprApplies presets that are configured in imgproxy.