Class GetImageAttributesOptions
-
- All Implemented Interfaces:
public final class GetImageAttributesOptionsOptions for generating responsive image attributes including
src,srcSet, andsizesfor HTML<img>elements. This schema extendsSrcOptionsto add support for responsive image generation with breakpoints.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classGetImageAttributesOptions.BuilderA builder for GetImageAttributesOptions.
-
Method Summary
Modifier and Type Method Description final SrcOptionstoSrcOptions()final Stringsrc()Accepts a relative or absolute path of the resource. final StringurlEndpoint()Get your urlEndpoint from the ImageKit dashboard. final Optional<Double>expiresIn()When you want the signed URL to expire, specified in seconds. final Optional<SrcOptions.QueryParameters>queryParameters()These are additional query parameters that you want to add to the final URL. final Optional<Boolean>signed()Whether to sign the URL or not. final Optional<List<Transformation>>transformation()An array of objects specifying the transformations to be applied in the URL. final Optional<TransformationPosition>transformationPosition()By default, the transformation string is added as a query parameter in the URL, e.g. final Optional<List<Double>>deviceBreakpoints()Custom list of device-width breakpoints in pixels. final Optional<List<Double>>imageBreakpoints()Custom list of image-specific breakpoints in pixels. final Optional<String>sizes()The value for the HTML sizesattribute (e.g.final Optional<Double>width()The intended display width of the image in pixels, used only when the sizesattribute is not provided.final JsonField<String>_src()Returns the raw JSON value of src. final JsonField<String>_urlEndpoint()Returns the raw JSON value of urlEndpoint. final JsonField<Double>_expiresIn()Returns the raw JSON value of expiresIn. final JsonField<SrcOptions.QueryParameters>_queryParameters()Returns the raw JSON value of queryParameters. final JsonField<Boolean>_signed()Returns the raw JSON value of signed. final JsonField<List<Transformation>>_transformation()Returns the raw JSON value of transformation. final JsonField<TransformationPosition>_transformationPosition()Returns the raw JSON value of transformationPosition. final JsonField<List<Double>>_deviceBreakpoints()Returns the raw JSON value of deviceBreakpoints. final JsonField<List<Double>>_imageBreakpoints()Returns the raw JSON value of imageBreakpoints. final JsonField<String>_sizes()Returns the raw JSON value of sizes. final JsonField<Double>_width()Returns the raw JSON value of width. final Map<String, JsonValue>_additionalProperties()final GetImageAttributesOptions.BuildertoBuilder()final GetImageAttributesOptionsvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static GetImageAttributesOptions.Builderbuilder()Returns a mutable builder for constructing an instance of GetImageAttributesOptions. -
-
Method Detail
-
toSrcOptions
final SrcOptions toSrcOptions()
-
src
final String src()
Accepts a relative or absolute path of the resource. If a relative path is provided, it is appended to the
urlEndpoint. If an absolute path is provided,urlEndpointis ignored.
-
urlEndpoint
final String urlEndpoint()
Get your urlEndpoint from the ImageKit dashboard.
-
expiresIn
final Optional<Double> expiresIn()
When you want the signed URL to expire, specified in seconds. If
expiresInis anything above 0, the URL will always be signed even ifsignedis set to false. If not specified andsignedistrue, the signed URL will not expire (valid indefinitely).Example: Setting
expiresIn: 3600will make the URL expire 1 hour from generation time. After the expiry time, the signed URL will no longer be valid and ImageKit will return a 401 Unauthorized status code.
-
queryParameters
final Optional<SrcOptions.QueryParameters> queryParameters()
These are additional query parameters that you want to add to the final URL. They can be any query parameters and not necessarily related to ImageKit. This is especially useful if you want to add a versioning parameter to your URLs.
-
signed
final Optional<Boolean> signed()
Whether to sign the URL or not. Set this to
trueif you want to generate a signed URL. IfsignedistrueandexpiresInis not specified, the signed URL will not expire (valid indefinitely). Note: IfexpiresInis set to any value above 0, the URL will always be signed regardless of this setting. Learn more.
-
transformation
final Optional<List<Transformation>> transformation()
An array of objects specifying the transformations to be applied in the URL. If more than one transformation is specified, they are applied in the order they are specified as chained transformations. See Chained transformations.
-
transformationPosition
final Optional<TransformationPosition> transformationPosition()
By default, the transformation string is added as a query parameter in the URL, e.g.,
?tr=w-100,h-100. If you want to add the transformation string in the path of the URL, set this topath. Learn more in the Transformations guide.
-
deviceBreakpoints
final Optional<List<Double>> deviceBreakpoints()
Custom list of device-width breakpoints in pixels. These define common screen widths for responsive image generation.
Defaults to
[640, 750, 828, 1080, 1200, 1920, 2048, 3840]. Sorted automatically.
-
imageBreakpoints
final Optional<List<Double>> imageBreakpoints()
Custom list of image-specific breakpoints in pixels. Useful for generating small variants (e.g., placeholders or thumbnails).
Merged with
deviceBreakpointsbefore calculatingsrcSet. Defaults to[16, 32, 48, 64, 96, 128, 256, 384]. Sorted automatically.
-
sizes
final Optional<String> sizes()
The value for the HTML
sizesattribute (e.g.,"100vw"or"(min-width:768px) 50vw, 100vw").If it includes one or more
vwunits, breakpoints smaller than the corresponding percentage of the smallest device width are excluded.If it contains no
vwunits, the full breakpoint list is used.
Enables a width-based strategy and generates
wdescriptors insrcSet.
-
width
final Optional<Double> width()
The intended display width of the image in pixels, used only when the
sizesattribute is not provided.Triggers a DPR-based strategy (1x and 2x variants) and generates
xdescriptors insrcSet.Ignored if
sizesis present.
-
_src
final JsonField<String> _src()
Returns the raw JSON value of src.
Unlike src, this method doesn't throw if the JSON field has an unexpected type.
-
_urlEndpoint
final JsonField<String> _urlEndpoint()
Returns the raw JSON value of urlEndpoint.
Unlike urlEndpoint, this method doesn't throw if the JSON field has an unexpected type.
-
_expiresIn
final JsonField<Double> _expiresIn()
Returns the raw JSON value of expiresIn.
Unlike expiresIn, this method doesn't throw if the JSON field has an unexpected type.
-
_queryParameters
final JsonField<SrcOptions.QueryParameters> _queryParameters()
Returns the raw JSON value of queryParameters.
Unlike queryParameters, this method doesn't throw if the JSON field has an unexpected type.
-
_signed
final JsonField<Boolean> _signed()
Returns the raw JSON value of signed.
Unlike signed, this method doesn't throw if the JSON field has an unexpected type.
-
_transformation
final JsonField<List<Transformation>> _transformation()
Returns the raw JSON value of transformation.
Unlike transformation, this method doesn't throw if the JSON field has an unexpected type.
-
_transformationPosition
final JsonField<TransformationPosition> _transformationPosition()
Returns the raw JSON value of transformationPosition.
Unlike transformationPosition, this method doesn't throw if the JSON field has an unexpected type.
-
_deviceBreakpoints
final JsonField<List<Double>> _deviceBreakpoints()
Returns the raw JSON value of deviceBreakpoints.
Unlike deviceBreakpoints, this method doesn't throw if the JSON field has an unexpected type.
-
_imageBreakpoints
final JsonField<List<Double>> _imageBreakpoints()
Returns the raw JSON value of imageBreakpoints.
Unlike imageBreakpoints, this method doesn't throw if the JSON field has an unexpected type.
-
_sizes
final JsonField<String> _sizes()
Returns the raw JSON value of sizes.
Unlike sizes, this method doesn't throw if the JSON field has an unexpected type.
-
_width
final JsonField<Double> _width()
Returns the raw JSON value of width.
Unlike width, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final GetImageAttributesOptions.Builder toBuilder()
-
validate
final GetImageAttributesOptions validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static GetImageAttributesOptions.Builder builder()
Returns a mutable builder for constructing an instance of GetImageAttributesOptions.
The following fields are required:
.src() .urlEndpoint()
-
-
-
-