camelot/arbitration

Middleware library & bundle for Intervention Image

dev-development 2022-10-12 11:33 UTC

This package is auto-updated.

Last update: 2024-11-12 15:58:38 UTC


README

camelot_arbitration:
    sets:
        list_page:
            - 300x169
            - 300x225
        page:
            - 1920x1080
            - 1024x768
    renditions:
        1920x1080:
            format: webp
            width: 1920
            height: 1080
        1024x768:
            format: webp
            width: 1024
            height: 768
        300x169:
            format: webp
            width: 300
            height: 169
        300x225:
            format: webp
            width: 300
            height: 225
camelot_arbitration:
    driver: gd # One of "gd"; "imagick"
    sets:

        # Prototype: List of rendition names to assign to the group
        name: [ ]
    renditions:

        # Prototype
        name:

            # Device pixel ratio.
            dpr: 1.0

            # Encodes the image to a specific format. Accepts 'jpg', 'pjpg' (progressive jpeg), 'png', 'gif', 'webp' or 'avif'. Defaults to 'jpg'.
            format: ~

            # Defines the quality of the image. Use values between 0 and 100. Defaults to 90. Only relevant if the format is set to 'jpg' or 'pjpg'.
            quality: ~

            # Sets the width of the image, in pixels.
            width: ~

            # Sets the height of the image, in pixels.
            height: ~

            # Rotates the image. Accepts 'auto', 0, 90, 180 or 270. Default is 'auto'. The auto option uses Exif data to automatically orient images correctly.
            orientation: ~ # One of "auto"; 0; 90; 180; 270

            # Crops the image to specific dimensions prior to any other resize operations. Required format: width,height,x,y
            crop: ~

            # Sets how the image is fitted to its target dimensions. Accepts:
            #  - contain: (default) Resizes the image to fit within the width and height boundaries without cropping, distorting or
            #             altering the aspect ratio.
            #  - max:     Resizes the image to fit within the width and height boundaries without cropping, distorting or altering
            #             the aspect ratio, and will also not increase the size of the image if it is smaller than the output size.
            #  - fill:    Resizes the image to fit within the width and height boundaries without cropping or distorting the image,
            #             and the remaining space is filled with the background color. The resulting image will match the
            #             constraining dimensions.
            #  - stretch: Stretches the image to fit the constraining dimensions exactly. The resulting image will fill the
            #             dimensions, and will not maintain the aspect ratio of the input image.
            #  - crop:    Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting
            #             image will match the width and height constraints without distorting the image.
            fit: ~ # One of "contain"; "max"; "fill"; "stretch"; "crop"

            # Flips the image. Accepts 'v', 'h' and 'both'.
            flip: ~ # One of "v"; "h"; "both"

            # Sets the background color of the image. Accepts hexadecimal RGB and RBG alpha formats.
            background: ~

            # Adjusts the image brightness. Use values between -100 and +100, where 0 represents no change.
            brightness: ~

            # Adjusts the image contrast. Use values between -100 and +100, where 0 represents no change.
            contrast: ~

            # Adjusts the image gamma. Use values between 0.1 and 9.99.
            gamma: ~

            # Adds a blur effect to the image. Use values between 0 and 100.
            blur: ~

            # Applies a filter effect to the image. Accepts 'greyscale' or 'sepia'.
            filter: ~ # One of "greyscale"; "sepia"

            # Applies a pixelation effect to the image. Use values between 0 and 1000.
            pixelate: ~

            # Sharpen the image. Use values between 0 and 100.
            sharpen: ~

            # Adds a watermark to the image.
            watermark:

                # Path to an image to be used as the watermark
                path: ~ # Required

                # Sets the width of the watermark in pixels, or using relative dimensions.
                width: ~

                # Sets the height of the watermark in pixels, or using relative dimensions.
                height: ~

                # Sets how the watermark is fitted to its target dimensions. Accepts:
                #  - contain: (default) Resizes the image to fit within the width and height boundaries without cropping, distorting or
                #             altering the aspect ratio.
                #  - max:     Resizes the image to fit within the width and height boundaries without cropping, distorting or altering
                #             the aspect ratio, and will also not increase the size of the image if it is smaller than the output size.
                #  - fill:    Resizes the image to fit within the width and height boundaries without cropping or distorting the image,
                #             and the remaining space is filled with the background color. The resulting image will match the
                #             constraining dimensions.
                #  - stretch: Stretches the image to fit the constraining dimensions exactly. The resulting image will fill the
                #             dimensions, and will not maintain the aspect ratio of the input image.
                #  - crop:    Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting
                #             image will match the width and height constraints without distorting the image.
                fit: ~ # One of "contain"; "max"; "fill"; "stretch"; "crop"

                # Sets how far the watermark is away from the left and right edges of the image. Set in pixels, or using relative dimensions. Ignored if 'position' is set to 'center'.
                offset_x: ~

                # Sets how far the watermark is away from the top and bottom edges of the image. Set in pixels, or using relative dimensions. Ignored if 'position' is set to 'center'.
                offset_y: ~

                # Sets how far the watermark is away from edges of the image. Basically a shortcut for using both 'offset_x' and 'offset_x'. Set in pixels, or using relative dimensions. Ignored if 'position' is set to 'center'.
                padding: ~

                # Sets where the watermark is positioned. Accepts 'top-left', 'top', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom', 'bottom-right'. Default is 'center'.
                position: ~

                # Sets the opacity of the watermark. Use values between 0 and 100, where 100 is fully opaque, and 0 is fully transparent.
                alpha: ~

Symfony Responses

public function __invoke(Request $request): Response
{
    // …

    $response->isNotModified($request);

    // …
}