Download the PHP package flokosiol/focus without Composer

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

Kirby Focus

Version License Kirby

With this plugin for Kirby CMS you can prevent the most important part of an image from being cropped when creating automated thumbs.

Kirby 4

[!NOTE] ✨ A core feature of Kirby 4

As of Kirby 4 this plugin has moved into core! Please find more infos on the official Kirby feature page.

There is a documented way how to migrate the existing data of your project using regex search and replace. Thanks @FynnZW!
And @bnomei created a Kirby CLI command to automate this process even further.

Thanks for your amazing feedback in the last years!

Kirby 3

The plugin does two things:

  1. It provides a custom field that allows you to set a focus point. The focus point is saved to the meta data file.
  2. It provides a new method focusCrop(), which uses the focus point saved in the meta data file to crop an image in such a way that the focus point is in the center of the cropped image – or (if that's not possible) at least isn't cropped.

⚙️ Requirements

Please check out the kirby-3.5 branch, if you are using Kirby 3.5 or a version even older than that.

💰 Commercial Usage

This plugin is free but if you use it in a commercial project please consider to make a donation.

🛠️ Installation

Download

Download and extract this repository, rename the folder to focus and drop it into the plugins folder of your Kirby 3 installation. You should end up with a folder structure like this:

Composer

If you are using Composer, you can install the plugin with

Git submodule

🖼️ Usage

1. Blueprint

Add the focus field to the fields of your file blueprint (!) and set type to focus like this:

2. Template

Use the focusCrop() method in your template to get a complete <img> tag:

As with every Kirby image object you can use all the known methods like this:

Some more stuff …

The plugin comes with some helper methods to get the x and y coordinates as floats or percentage values.

Focus (without cropping)

As mentioned by several people (Matthias, Guillaume and Ola) the plugin can also be used to set a custom background position without cropping the image.

Presets

If you are using the same config for focus-cropped images over and over again in your project, as of version 3.0.3 you can define them as presets in your config.php like this:

Afterwards, you can use the presets in your templates (assuming $image is a Kirby image object).

Focus and srcset becomes focusSrcset()

As of Kirby 3.2 a new srcset method was introduced. Since version 3.0.3 of the Focus plugin, you can use the following syntax in your templates to respect the focus point in your srcset options:

As of version 3.0.7 you can furthermore define your srcsets in your config.php.

In your template file you can use the defined srcset like this:

➕ Extensions and implementations

Autofocus

Sylvain created the first Focus extension. Make sure to check it out!

This plugin acts as a JS image.upload / image.replace hook, processing the / each image with the focus component, determining its appropriate focus point and saving it to the meta data file.

https://github.com/sylvainjule/kirby-autofocus

Colorist

Kirby Colorist by @S1SYPHOS is fully compatible with Kirby Focus. This plugin is capable of image conversion to AVIF, WebP and some other formats, as well as resizing them.

📋 License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

🙌 Credits

Special thanks to all contributors!


All versions of focus with dependencies

PHP Build Version
Package Version
Requires getkirby/cms Version <3.6
getkirby/composer-installer Version ^1.1
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 flokosiol/focus contains the following files

Loading the files please wait ....