Download the PHP package guizoxxv/laravel-multi-size-image without Composer

On this page you can find all versions of the php package guizoxxv/laravel-multi-size-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-multi-size-image

Laravel Multi Size Image

Laravel package to optimize and store images in different sizes in order to load the appropriate one according to the screen size.

Requirements

Installation

Require the package via Composer:

Configuration

Publish the package configuration file to your Laravel project to change the default behavior.

A config/multiSizeImage.php file will be added in your project.

Usage

1. Instantiate

To apply Multi Size Image first you must create an instance of it.

2. Process image

Call the processImage method passing the file path as the first argument.

The file path must be absolute.

The method returns an array of strings with the full path of the generated files.

2.1. Mime types

Only mime types defined in the mime_types array in the config/multiSizeImage.php file are considered. If a file with mime type not present is used, it is ignored and the method returns null.

This package is configured to optimize jpeg and png images. Check the Optimizing section to learn how to optimize images with other mime types.

2.2. Output path

The default behavior is to create the resized image versions in the same path as the original's. To send the images to a different location you can provide the output path as a second optional parameter.

The basePath optional parameter can be used to keep the original file path as of this path.

2.3. Resizing

The resizable values are defined by the sizes array in the config/multiSizeImage.php file. This array has the keys as the size identification and the value as the size for the image to be resized to.

Above are the default values. The biggest dimension is considered when resizing and the aspect ratio is kept. An auto-generated name will be used as the new file name. The size identification is used as a suffix in the file name to distinguish which will be loaded.

Example:

If a 2000x1000px (width x height) image is used, the following files will be generated:

If the image width and height are lower than the specified resize value, the image is not resized and the new file is generated without a suffix.

Example:

If a 100x200px (width x height) image is used, the following files will be generated:

2.4. File name

If you want to keep the original's file name instead of using an auto-generated one, set keep_original_name to true in the config/multiSizeImage.php file.

You can also provide an optional custom name as a forth parameter to the processImage method.

2.5. Optimizing

By default the newly generate image is also optimized using image-optimizer package with JpegOptim, Optipng and Pngquant 2 optimizers with the following OptimizerChain.

To override the default optimization behavior you can provide a custom OptimizerChain as an argument when instantiating MultiSizeImage.

You can also disable optimization by setting optimize to false in the config/multiSizeImage.php file.

2.6. Delete original

The default behavior is to delete the original image after processing if the resized files names don't match the original's (changed name or path). If you choose to keep it, set keep_original_file to true in the config/multiSizeImage.php file.

3. Render

Render the image file according to the screen size.

Remember to provide a fallback in case the image name does not have a suffix.


All versions of laravel-multi-size-image with dependencies

PHP Build Version
Package Version
Requires intervention/image Version ^2.5
spatie/image-optimizer Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package guizoxxv/laravel-multi-size-image contains the following files

Loading the files please wait ....