Download the PHP package coderello/laravel-proximage without Composer

On this page you can find all versions of the php package coderello/laravel-proximage. 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-proximage

Proximage

Proximage is a handy package for proxying images through the images.weserv.nl (free image cache & resize service) with which you can greatly increase the performance of the site.

Installation

You can install this package via composer using this command:

The package will automatically register itself.

You can publish the config file with:

Some important notes

Images are not processed on your server (package generates a link to your image processed by a third-party service).

The only way to specify an input image is to pass its public link.

Examples of use

Only caching:

Caching and resizing:

Caching and cropping:

Basic methods

url(?string $value): self

Sets the link to your input image.

parameter(string $name, $value): self

Sets the value of the parameter by its name.

You can find all existing parameter names in Parameter enum situated in Coderello\Proximage\Enums namespace.

More handy way is to use methods for image manipulations which can be found in the section below.

shouldProxy(Closure $shouldProxy): self

Sets callback which detects if given image should be proxied. Callback receives $url as the first argument and should return true or false.

template($template): self

Applies template to the current ImageProxy instance.

Accepts:

Out-of-the-box templates (you can find them in Coderello\Proximage\Templates namespace):

Of course, you are not limited to these ones. You can create your own templates. Each one must implement Template contract situated in the Coderello\Proximage\Contracts namespace.

get(): ?string

Returns URL of proxied image.

Methods for image manipulations

width($value): self

Sets the width of the image, in pixels.

height($value): self

Sets the height of the image, in pixels.

devicePixelRatio($value): self

The device pixel ratio is used to easily convert between CSS pixels and device pixels. This makes it possible to display images at the correct pixel density on a variety of devices such as Apple devices with Retina Displays and Android devices. You must specify either a width, a height, or both for this parameter to work. Use values between 1 and 8.

transformation($value): self

Controls how the image is fitted to its target dimensions.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\Transformation

Accepts:

Default. Resizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will not oversample the image if the requested size is larger than that of the original.

Resizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will increase the size of the image if it is smaller than the output size.

Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will increase the size of the image if it is smaller than the output size.

Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will not oversample the image if the requested size is larger than that of the original.

Stretches the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image.

Resizes the image to fit within the width and height boundaries without cropping or distorting the image, and the remaining space is filled with the background color. The resulting image will match the constraining dimensions.

crop($value): self

Controls how the image is aligned.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\CropAlignment

Crop position

You can set where the image is cropped by adding a crop position. Only works when transformation is Transformation::SQUARE. Accepts CropAlignment::TOP, CropAlignment::LEFT, CropAlignment::CENTER, CropAlignment::RIGHT or CropAlignment::BOTTOM. Default is CropAlignment::CENTER.

Crop focal point

In addition to the crop position, you can be more specific about the exact crop position using a focal point. Only works when transformation is Transformation::SQUARE. This is defined using two offset percentages: crop-x%-y%.

Smart crop

Crops the image down to specific dimensions by removing boring parts. Only works when transformation is Transformation::SQUARE.

Accepts:

Manual crop

Crops the image to specific dimensions after any other resize operations. Required format: width,height,x,y.

mask($value): self

Sets the mask type from a predefined list of shapes.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\Mask

Accepts:

maskTrim($value): self

Removes the remaining whitespace from the mask.

maskBackground($value): self

Sets the background color of the mask.

orientation($value): self

Rotates the image. Accepts auto or if an angle is specified, it is converted to a valid 90/180/270 degree rotation. For example, -450 will produce a 270 degree rotation. Default is auto. The auto option uses Exif data to automatically orient images correctly.

brightness($value): self

Adjusts the image brightness. Use values between -100 and +100, where 0 represents no change.

contrast($value): self

Adjusts the image contrast. Use values between -100 and +100, where 0 represents no change.

gamma($value): self

Adjusts the image gamma. Use values between 1 and 3. The default value is 2.2, a suitable approximation for sRGB images.

sharpen($value): self

Sharpen the image. Required format: f,j,r

Arguments:

trim($value): self

Trim "boring" pixels from all edges that contain values within a similarity of the top-left pixel. Trimming occurs before any resize operation. Use values between 1 and 254 to define a tolerance level to trim away similar color values. You also can specify just &trim, which defaults to a tolerance level of 10.

background($value): self

Sets the background color of the image. Supports a variety of color formats. In addition to the 140 color names supported by all modern browsers (listed here), it also accepts hexadecimal RGB and RBG alpha formats.

Hexadecimal

blur($value): self

Adds a blur effect to the image. Use values between 0 and 100.

filter($value): self

Applies a filter effect to the image.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\Filter

Accepts:

quality($value): self

Defines the quality of the image. Use values between 0 and 100. Defaults to 85. Only relevant if the format is set to Output::JPG.

output($value): self

Encodes the image to a specific format. If none is given, it will honor the origin image format.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\Output

Accepts:

interlace($value): self

Adds interlacing to GIF and PNG. JPEG's become progressive.

encoding($value): self

Encodes the image to be used directly in the src= of the <img>-tag.

Namespace of enum with possible values: Coderello\Proximage\Enums\Parameter\Encoding

Accepts:

defaultImage($value): self

If there is a problem loading an image, then a error is shown. However, there might be a need where instead of giving a broken image to the user, you want a default image to be delivered.

page($value): self

To load a given page (for an PDF, TIFF and multi-size ICO file). The value is numbered from zero.

filename($value): self

To specify the filename returned in the Content-Disposition header. The filename must only contain alphanumeric characters.

Testing

You can run the tests with:

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-proximage with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
laravel/framework Version ^6.0|^7.0|^8.0
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 coderello/laravel-proximage contains the following files

Loading the files please wait ....