Blade Component to Serve Images and Download Files

Smart makes it possible to serve images and download files from any location, including Laravel disks within a Laravel application. Allows you to resize and cache images before sending them to the browser. Templates make it easy to pre-configure your settings for use throughout your site.

Smart allows easy manipulation and downloading of images without any backend code:

  • serve images from anywhere this could be a public path, a private path, or a Laravel disk
  • resize images not only defining the height and width in the html image tag, but also changing the size of the content passed to the browser
  • apply templates to images, change settings for all images in one place
  • automatically cache your images
  • apply the Full Image / Intervention API to a picture
  • download files from anywhere this could be a public path, a private path, or a Laravel disk

Using S3 as an example, this is how you can load an image from an S3 compatible storage disk:

1<x-smart-image data-disk="s3" src="logos/mybrand.jpg"/>

Smart Download is another unique feature this package offers, allowing you to download any image or file with a blade component. You do not need to program the backend portion of your code to provide streams of files; this package handles all of that:

1<x-smart-download src="{{ storage_path('manual.pdf') }}" target="_blank" />

The readme file has many examples to help you get started with this package. The author also has a video demo for those who want practical visual examples:

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Leave a Comment