Download the PHP package c2h6/twill-croppa without Composer

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

twill-croppa

Use Croppa as media rendering service in Twill applications.

Learn more about Croppa at https://github.com/BKWLD/croppa

Learn more about Twill CMS at https://twillcms.com

About this package

This package provides an easy-to-use integration of the Croppa image library into Twill CMS to use as a media and image rendering service. When switching to the provided rendering service, the advantages of Croppa can be used in your Twill application. In addition, a few other utils for working with media in the context of Twill are offered.

Features

Prequesites/Versioning

Use the following table to find the right version for your Laravel/Twill/Croppa version to fit your environment.

All package releases are available via GitHub and Packagist releases to download.

Package version Croppa version Twill version Laravel version
1.x 6.x 3.x 10.x
2.x 6.x (Patched)* 3.4 11.x
3.x (Current Version) 6.x (Patched)* 3.5/dev 12.x

[!WARNING]

V3 depends on a forked version of BKWLD/croppa with applied patches to function with Laravel 12 and the newest version of Twill. Twill depends on older versions of packages used by Croppa, resulting in dependency configurations not installable by composer.

The Fork and more information is available at https://github.com/C2H6-383/croppa. As soon, as these dependency conflicts are resolved, twill-croppa will get an update to use the original version of Croppa once more.

Requirements

This package requires the Composer PHP package manager to function and manage its dependencies.

In addition, this package only depends on Twill CMS and Croppa and their dependencies. This is automatically managed via Composer.

Installation

Installation of this library is easy to do via Composer:

[!IMPORTANT] To use this package in your Laravel project with the patched version of Croppa, you need to add the vsc repository for the patched Croppa version to your root composer-file by adding:

Please run composer u to update your packages after that.

If you do not need the patched version of Croppa, please use version 1.x of this package.

Package discovery is automatically done by the Laravel Framework.

You should already set up the storage linking for storing your media files. For further information check the Twill CMS Docs.

Usage

Using the Croppa rendering service is really easy. Just set the rendering service config property in the Twill configuration. Everything else is set up for you.

To set the Image Rendering Service edit the media_library.image_service property in the twill.php config file. You maybe need to publish the Twill config files first or add the config properties.

For more additional help see https://twillcms.com/docs/media-library/image-rendering-service.html

A note on performance

When accessing crops for the first time, Croppa needs to render each image. On some servers or environment configurations, this is really slow (2+ seconds per image request). This gets exponentially worse when having many crops or images per page, as these are rendered on-demand.

To hide this from normal visitors when accessing the page, it is recommended to view the preview or access the page before publishing and waiting for all images to load in. An alternative is to render the crops programmatically (see the Croppa documentation section about the render command) beforehand or via a queue job.

To use the LQIP images, use the command php artisan twill:lqip to generate and store them in the database.

Configuration Options

If you want to change configuration options of this plugin, you can either create a new configuration file called twillcroppa.php in the Laravel config directory or publish the default configuration file with the command php artisan vendor:publish --tag=twillcroppa-config. A list with a detailed description of the configuration options is displayed below.

This library automatically configures some croppa parameters. To further refine the Croppa settings, please refer to the configuration options of Croppa stated in the Croppa documentation.

config option Default description
lqip_dimension 30 Default image width/height of the LQIP image if dimensions are not provided.
lqip_quality 25 JPEG quality (0-100) for the LQIP images, higher means better image quality but larger files
media_files_path storage/uploads/ uploads storage path (URL) for discovering and deleting crops

Extra: Media Detaching on Model deletion

When dealing with media models while working with Twill there is often the burden to detach any media when deleting a model. Otherwise, there are some dangling references remaining and any of these media files can never be deleted from the application, as twill registers some usage cases.

To speed this process up, this package contains a few PHP traits to automatically detach any media relations on deleting or force deleting a given model:

C2H6\TwillCroppa\Traits\DetachMediaOnForceDelete::class for automatically deleting relations on model force deletion and

C2H6\TwillCroppa\Traits\DetachMediaOnDelete::class for automatically deleting relations on model (soft) deletion.

For normal use cases, only the first one should be needed, as Twill always uses soft deletes per default. On model deletion, the model is put in a Trash section, where a recovery is possible. Only on removal from this Trash section, a media detachment should be done.

Usage

To use these traits just add them to any of your models and they should work out of the box.

Package Development


All versions of twill-croppa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3|^8.4
illuminate/support Version ^12.0
area17/twill Version ^3.5.2|^3.x-dev
bkwld/croppa Version dev-master
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 c2h6/twill-croppa contains the following files

Loading the files please wait ...