Git Product home page Git Product logo

imagingbundle's Introduction

Mesavolt/ImagingBundle

Build Status Coverage Status

Installation

Use composer:

composer require mesavolt/imaging-bundle

Applications that don't use Symfony Flex

If you don't use Symfony Flex, you need to enable the bundle by hand. To to so, add it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Mesavolt\ImagingBundle\ImagingBundle(),
        );
        // ...
    }
    // ...
}

Configuration

The following options are available to customize the behavior of the bundle's imaging service :

Option name Default value Role
imaging.transparency_replacement #FFFFFF The color used to replace transparent areas

Usage

Inject the Mesavolt\ImagingBundle\ImagingService service into your services and controllers (or get the mesavolt.imaging service from the container) :

<?php

namespace App;


use Mesavolt\ImagingBundle\Service\ImagingService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class HomeController extends AbstractController
{
    public function index(ImagingService $imagingService)
    {
        $relative = '/public/thumbnails/thumbnail.jpeg';
        $path = $this->getParameter('kernel.project_dir').$relative;
        $imagingService->shrink('/tmp/image.jpg', $path);
        
        return $this->render('home/index.html.twig', [
            'shrunk' => $relative
        ]);
    }
}

imagingbundle's People

Contributors

mrmitch avatar dependabot-preview[bot] avatar

Stargazers

Sébastien HEITZMANN avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.