Download the PHP package abwebdevelopers/oc-imageresize-plugin without Composer

On this page you can find all versions of the php package abwebdevelopers/oc-imageresize-plugin. 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 oc-imageresize-plugin

October CMS Image Resize Plugin

Resize and transform images on the fly in Twig and October CMS.

Requirements

Please note that GD is bound by PHP's memory limits, whereas Imagick isn't. If your site returns 503 when resizing images, try Imagick (can be changed via Settings).

Getting started

Installation

You can install this plugin in a number of ways:

Via Composer

Run the following commands in your October CMS project folder to install the plugin.

Via Updates & Plugins screen

In the October CMS backend, you can navigate to Settings > Updates & Plugins and then click the Install Plugins button to install a plugin to your October CMS install. Add ABWebDevelopers.ImageResize to the search box to be able to select this plugin and install it.

Via command-line

Run the following command in your October CMS project folder to install the plugin.

October CMS usage

This plugin utilises Intervention Image's magical powers to resize and transform your images with ease. Please note that this plugin does not cover every feature of the Intervention Image library.

Basic Resizing

Twig Filter: | resize(int $width, int $height, array $options)

Basic resizing in Twig is done using the | resize filter. Resizing requires at least one of the two dimension arguments.

A third argument is available, options, which allows you specify the resizing mode, along with any other image modifications which are detailed below.

Resizing Modes

Resizing modes are almost synonymous to CSS3 background-size modes to make it easier to remember. Available options are: auto (default), cover and contain, each doing the same as their CSS equivalent, with one additional mode: stretch which behaves how a basic <img> element would:

When using mode: cover (alias mode: crop) you may specify the fit_position modifier to choose where the center of the resize should be focused.

Further Modifications

A few image adjustment tools and filters have been implemented into this plugin, which utilise their Intervention Image library counterparts.

Usage of the modifiers is simple, either add them in a key: value fashion in the 3rd argument of the resize filter, or by using the modify filter, as such:

Modifier Name Code Rules Examples Details
Format format in:jpg,png,webp,bmp,gif,ico,auto jpg, png, auto, ... Change the format of the image.
Blur blur min:0 max:100 0, 50, 100 Blurs the image
Sharpen sharpen min:0 max:100 0, 50, 100 Sharpens the image
Brightness brightness min:-100 max:100 -100, 50, 100 Brightens (or darkens) the image
Contrast contrast min:-100 max:100 -100, 50, 100 Increases/decreases the contrast of the image
Pixelate pixelate min:1 max:1000 1, 500, 1000 Pixelates the image
Greyscale greyscale/grayscale accepted true, 1 See accepted rule. Sets the image mode to greyscale. Both codes are accepted (one just maps to the other)
Invert invert accepted true, 1 See accepted rule. Inverts all image colors
Opacity opacity min:0 max:100 0, 50, 100 Set the opacity of the image
Rotate rotate min:0 max:360 45, 90, 360 Rotate the image (width / height does not constrain the rotated image, the image is resized prior to modifications)
Flip flip 'h' or 'v' h, v Flip horizontally (h) or vertically (v)
Background fill/background Hex color #fff, #123456, 000 Set a background color - Hex color (with or without hashtag). Both codes are accepted (one just maps to the other)
Colorize colourise/colorize string (format: r,g,b) 255,0,0, 0,50,25 Colorize the image. String containing 3 numbers (0-255), comma separated. Both codes are accepted (one just maps to the other)

A couple examples from the above:

Please Note: In order to encode images to WebP format, you will need to enable WebP support on your chosen driver (Imagick or GD). It's likely that by default you will not have WebP support, so using this format may result in errors or broken images.

Filters (templates for configuration)

Filters in the Image Resize plugin, while following a similar concept to filters in Intervention Image, are handled differently in this plugin.

Filters are specified in the Settings > Image Resizer page. By clicking the Filters tab at the top, you can specify a filter "code" which can apply a set of enhancements and modifications to an image. Once saved, you can then use the filter option in the resize and modify Twig filters to specify the filter to use.

A common example would be a basic thumbnail - you want this to always be format: jpg, mode: cover, quality: 60, max_width: 200, max_height: 200 and maybe background: #fff.

With filters, you can specify the above, call it something useful like thumbnail, then simply do the following:

Which will use the predefined list of modifiers and have them overwritten by any that are supplied, for example:

There are a couple new modifiers for filters which include: min_width, max_width, min_height, max_height which all act as constraints for the dimensions of the images using filters.

Should you use one, please note that if you use it with the | resize(w, h) function, your supplied dimensions will be ignored if they are out of bounds of the constraints.

Using the library in PHP

Should you want to implement your own use of this library outside of Twig, you can use it in a very similar manner:

Which is synonymous to:

Bugs and New Features

We encourage you to open PRs and/or issues relating to any bugs or features so that everyone can benefit from them.

Special thanks to


All versions of oc-imageresize-plugin with dependencies

PHP Build Version
Package Version
Requires intervention/image Version 2.4.*
php Version >=7.0
composer/installers Version ~1.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 abwebdevelopers/oc-imageresize-plugin contains the following files

Loading the files please wait ....