Skip to content

Latest commit

 

History

History
105 lines (81 loc) · 2.15 KB

media.md

File metadata and controls

105 lines (81 loc) · 2.15 KB

application.media

Set application media options.

Options;

<?php

return [
    'application.media' => [
        'sizes.$name' => (boolean|int|array) false|$width|[
            'width'|'w' => (int) $width,
            'height'|'h' => (int) $height,
            'crop' => (boolean) $enable_crop,
        ],
        'mimes.$name' => (boolean|string) $enable_mime_type,
        'uploads.organize' => (boolean) $enable_upload_organization,
    ],
];

Examples;

<?php

return [
    'application.media' => [
        'sizes.thumbnail' => [
            'width' => 200,
            'height' => 200,
            'crop' => true,
        ],
        'sizes.medium' => 400,
        'sizes.large' => 1200,
        'mimes.png' => false,
        'mimes.svg' => true,
        'uploads.organize' => true,
    ],
];

Image Sizes

Intervention can register custom image sizes.

<?php

return [
    'application.media' => [
        'sizes.100vw' => 1800,
        'sizes.3/12' => 400,
        'sizes.4/12' => 600,
        'sizes.6/12' => 800,
        'sizes.9/12' => 1200,
        'sizes.12/12' => 1600,
        'sizes.sq.w' => 600,
        'sizes.sq.h' => 600,
        'sizes.sq.crop' => true,
    ],
];

To remove an image size pass in false.

<?php

return [
    'application.media.sizes.medium' => false,
];

Mime Types

To enable custom mimes, a string of the mime type will need to be passed.

  • Intervention has built in support for svg and svgz, so you can simply pass in true.

Enabling custom mimes;

<?php

return [
    'application.media' => [
        'mimes.svg' => true,
        'mimes.bmp' => 'image/bmp',
        'mimes.webm' => 'video/webm',
    ],
];

Further Reading;

Bug?