Download the PHP package aropixel/sylius-admin-media-plugin without Composer
On this page you can find all versions of the php package aropixel/sylius-admin-media-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aropixel/sylius-admin-media-plugin
More information about aropixel/sylius-admin-media-plugin
Files in aropixel/sylius-admin-media-plugin
Package sylius-admin-media-plugin
Short Description Enhanced sylius admin media management with image cropping, library...
License MIT
Informations about the package sylius-admin-media-plugin
Sylius Admin Media Plugin
Enhanced sylius admin media management with image cropping, library (based on Artgris Media Bundle)
Table of contents
- Presentation
- Installation
- Usage
- License
Presentation
Once the plugin is installed and configured, the sylius image system for the ressource (product etc) will be replaced by complete media management system. You'll be able to:
- upload image (of course)
- open a file manager in order to retrieve all the image uploaded, and select one of them
- crop freely the image directly in the admin before saving it
- select a format that will force you to crop the image with a certain ratio)
This plugin is heavily based on the artgris media bundle and file manager.
Installation
In a sylius application :
- Install the plugin :
composer require aropixel/sylius-admin-media-plugin
If the plugin is not registered in the config/bundles.php file, register it by adding "Aropixel\SyliusAdminMediaPlugin\AropixelSyliusAdminMediaPlugin::class => ['all' => true],"
-
Create a aropixel_sylius_admin_media.yaml in the config folder and import the plugin configuration:
-
Create a aropixel_sylius_admin_media.yaml in the config/routes folder and import the plugin routes:
-
In the bundles.php file, register the new plugins:
-
Create the 'uploads' folder in the 'public' folder
- install the assets:
Usage
For each ressource, you can define crops format (ratio) that you want to use for cropping the image in admin. Each crop definied is linked to a liip filter so that the ratio of the crop is automatically calculated based on the liip filter size.
For example, imagine you have a blog system in your sylius app and you want to display each blog post in the home with a thumbnail. You have two sylius ressource: Post Entity and a PostImage entity.
-
First you need to create the admin form for your Post entity, and also the admin form for your PostImage entity. The entity form will add the AdminMediaCollectionType for the images:
-
The PostImage form will need to extend the ImageType defined by the plugin, example;
-
Then register the image form in the services.yaml:
-
In a classic sylius application, you generally use liip filters in order to generate, in front the thumbnail of your image blog post, example:
- When the admin upload the image for the blog post, with this plugin, he can choose a defined format in order to be able to crop the image at the correct ratio, before saving it, so that the image is perfectly suited for the thumbnail! Here is the configuration of the plugin if you want to let the admin crop the image using the home_news liip filter size:
You can also add default crop format, available for all images:
And that's it! You can now in the admin choose a format and crop it with a specfic ratio so that it's perfectly suited for your page!
License
Aropixel Blog Bundle is under the MIT License