Class: Imagekitio::Models::GetImageAttributesOptions

Inherits:
SrcOptions show all
Defined in:
lib/imagekitio/models/get_image_attributes_options.rb

Instance Attribute Summary collapse

Attributes inherited from SrcOptions

#expires_in, #query_parameters, #signed, #src, #transformation, #transformation_position, #url_endpoint

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(device_breakpoints: nil, image_breakpoints: nil, sizes: nil, width: nil) ⇒ Object

Some parameter documentations has been truncated, see Imagekitio::Models::GetImageAttributesOptions for more details.

Options for generating responsive image attributes including ‘src`, `srcSet`, and `sizes` for HTML `<img>` elements. This schema extends `SrcOptions` to add support for responsive image generation with breakpoints.

Parameters:

  • device_breakpoints (Array<Float>) (defaults to: nil)

    Custom list of **device-width breakpoints** in pixels.

  • image_breakpoints (Array<Float>) (defaults to: nil)

    Custom list of **image-specific breakpoints** in pixels.

  • sizes (String) (defaults to: nil)

    The value for the HTML ‘sizes` attribute

  • width (Float) (defaults to: nil)

    The intended display width of the image in pixels,



# File 'lib/imagekitio/models/get_image_attributes_options.rb', line 51

Instance Attribute Details

#device_breakpointsArray<Float>?

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.

Returns:

  • (Array<Float>, nil)


14
# File 'lib/imagekitio/models/get_image_attributes_options.rb', line 14

optional :device_breakpoints, Imagekitio::Internal::Type::ArrayOf[Float], api_name: :deviceBreakpoints

#image_breakpointsArray<Float>?

Custom list of **image-specific breakpoints** in pixels. Useful for generating small variants (e.g., placeholders or thumbnails).

Merged with ‘deviceBreakpoints` before calculating `srcSet`. Defaults to `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.

Returns:

  • (Array<Float>, nil)


24
# File 'lib/imagekitio/models/get_image_attributes_options.rb', line 24

optional :image_breakpoints, Imagekitio::Internal::Type::ArrayOf[Float], api_name: :imageBreakpoints

#sizesString?

The value for the HTML ‘sizes` attribute (e.g., `“100vw”` or `“(min-width:768px) 50vw, 100vw”`).

  • If it includes one or more ‘vw` units, breakpoints smaller than the corresponding percentage of the smallest device width are excluded.

  • If it contains no ‘vw` units, the full breakpoint list is used.

Enables a width-based strategy and generates ‘w` descriptors in `srcSet`.

Returns:

  • (String, nil)


37
# File 'lib/imagekitio/models/get_image_attributes_options.rb', line 37

optional :sizes, String

#widthFloat?

The intended display width of the image in pixels, used **only when the ‘sizes` attribute is not provided**.

Triggers a DPR-based strategy (1x and 2x variants) and generates ‘x` descriptors in `srcSet`.

Ignored if ‘sizes` is present.

Returns:

  • (Float, nil)


49
# File 'lib/imagekitio/models/get_image_attributes_options.rb', line 49

optional :width, Float