Acilia Asset Bundle

1.0.0 2021-12-29 13:41 UTC

This package is not auto-updated.

Last update: 2024-02-15 22:45:29 UTC


Acilia Asset Bundle for Symfony2 and symfony3


Symfony2 and Symfony3 Asset bundle developed by Acilia Internet

This bundle allows to upload and crop images, and save the images as an "Asset" entity on a database.

Installation and configuration:

Pretty simple with Composer, run:

composer require aciliainternet/asset-bundle

Add AssetBundle to your application kernel

// app/AppKernel.php
public function registerBundles()
    return array(
        // ...
        new Acilia\Bundle\AssetBundle\AciliaAssetBundle(),
        // ...

Add assets resources to your public dir

php bin/console assets:install web/backend/

Link resources on your template

{% stylesheets
    filter='cssrewrite' output='css/compiled/app.css' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

% javascripts
    output='js/compiled/app.js' %}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

Configuration example

You must configure some parameters

    assets_images: Resources/config/images.yml  # yaml file to indicate ratios and sizes
    assets_dir: /var/www/media/                 # path to where store the images uploaded
    assets_public: /media                       # relative path to the images on the web server (default /media)
    assets_domain:            # domain from which the images can be access

Image sizes file example:

ratios: { 177: 16x9, 100: 1x1, 200: 2x1, 133: 4x3 }

    main_highlight: { large: 1200x675,  medium: 1024x576, small: 640x640 }
    big_cards: { large: 1200x675, medium: 1024x576, small: 640x360 }
    secondary_highlight: { large: 600x338, medium: 1024x576, small: 640x360 }

            title: Main
            renditions: [ main_highlight, secondary_highlight, big_cards ]
            attribute: image

            title: Main image
            renditions: [ main_highlight, big_cards ]
            attribute: picture