trait HasModificationMedia (View source)

Optional: apply to a Modification subclass (which must also implement Spatie\MediaLibrary\HasMedia and use InteractsWithMedia) to allow attaching images to a pending change. Requires spatie/laravel-medialibrary, which this package does not depend on directly.

Methods

void
registerMediaConversions(Media|null $media = null)

Register the thumb (300x200) and normal (800x600) image conversions.

Media
addImage(UploadedFile $image, array $meta)

Attach an image to the main media collection.

static array|null
imageLoad(Media|null $media, array $loads = ['thumb', 'normal', 'original'])

The name, the label and the URL of each requested size of an image.

Details

void registerMediaConversions(Media|null $media = null)

Register the thumb (300x200) and normal (800x600) image conversions.

Parameters

Media|null $media

Return Value

void

Media addImage(UploadedFile $image, array $meta)

Attach an image to the main media collection.

Parameters

UploadedFile $image
array $meta

n or name and l or label are required. d or description, h or helpText, and i, imageIndex or index are optional.

Return Value

Media

static array|null imageLoad(Media|null $media, array $loads = ['thumb', 'normal', 'original'])

The name, the label and the URL of each requested size of an image.

Parameters

Media|null $media
array $loads

Any of thumb, normal and original.

Return Value

array|null

Null when there's no image.