van-ons/laravel-attachment-library
Attach files to Laravel Eloquent models with a simple HasAttachments trait and Attachment model. Includes installer command for migrations/assets and an attachments relationship to link existing uploads to any model.
This package includes a Blade component for loading responsive images that scale depending on breakpoints. This ensures optimal performance by delivering appropriately sized images for different screen sizes.
To use the responsive image component, simply include it in your Blade template as follows:
<x-laravel-attachment-library-image :src="$image" />
src: The source of the image. This can be a file path string, an Attachment object, or a numeric ID.size: The size ratio of the image. Available sizes are defined in the glide.php config file.aspectRatio: The aspect ratio of the image.class: Additional CSS-classes.The Resizer class is responsible for resizing images. It is also possible to call this class directly from other places
in the application.
The Resizer class returns an array with width, height and url. The URL should be used as source for the image element.
An example code snippet could be:
\VanOns\LaravelAttachmentLibrary\Facades\Resizer::src($image)
->height(200)
->width(500)
->resize();
/**
* Valid source:
* [
* 'width' => 500,
* 'height' => 200,
* 'url' => 'http://test.local/img/path-to-image.jpg?w=500&h=200&signature=....'
* ]
*
* Invalid source:
* []
*/
How can I help you explore Laravel packages today?