Giter Site home page Giter Site logo

liip / liipimaginebundle Goto Github PK

View Code? Open in Web Editor NEW
1.6K 80.0 380.0 8.71 MB

Symfony Bundle to assist in imagine manipulation using the imagine library

Home Page: http://liip.ch

License: MIT License

PHP 99.69% Shell 0.23% Twig 0.08%
php symfony-bundle bundle symfony

liipimaginebundle's Introduction

LiipImagineBundle

PHPUnit PHP-CS-Fixer Coverage Downloads Release
PHPUnit PHP-CS-Fixer Coverage Downloads Latest Stable Version

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

Overview

Example

Suppose you defined a my_thumb filter set, which can be configured to perform any number of different transformations. The simplest invocation would be to pipe the path of your image to the provided imagine_filter Twig filter.

<img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb') }}" />

Contributor Code of Conduct

This project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Attribution

  • Thanks to the many contributors who have dedicated their time and code to this project.

  • The standalone PHP Imagine Library is used by this bundle for image transformations.

  • This package was forked from AvalancheImagineBundle with the goal of making the code more extensible. Reference AvalancheImagineBundle#25 for additional information on the reasoning for this fork.

Setup

Installation

Using this package is similar to all Symfony bundles. The following steps must be performed

  1. Download the Bundle
  2. Enable the Bundle
  3. Register the Routes

Detailed setup instructions can be found in the installation chapter of the documentation.

Configuration

Detailed information on all available configuration options can be found in the configuration chapter of the documentation.

Usage Primer

Generally, this bundle works by applying filter sets to images from inside a template. Your filter sets are defined within the application's configuration file (often app/config/config.yml) and are comprised of a collection of filters, post-processors, and other optional parameters.

We'll learn more about post-processors and other available parameters later, but for now lets focus on how to define a simple filter set comprised of a few filters.

Create Thumbnails

Before we get started, there is a small amount of configuration needed to ensure our data loaders and cache resolvers operate correctly. Use the following boilerplate in your configuration file.

# app/config/config.yml

liip_imagine :

    # configure resolvers
    resolvers :

        # setup the default resolver
        default :

            # use the default web path
            web_path : ~

    # your filter sets are defined here
    filter_sets :

        # use the default cache configuration
        cache : ~

With the basic configuration in place, we'll start with an example that fulfills a common use-case: creating thumbnails. Lets assume we want the resulting thumbnails to have the following transformations applied to them:

  • Scale and crop the image to 120x90px.
  • Add a 2px black border to the scaled image.
  • Adjust the image quality to 75.

Adding onto our boilerplate from above, we need to define a filter set (which we'll name my_thumb) with two filters configured: the thumbnail and background filters.

# app/config/config.yml

liip_imagine :
    resolvers :
        default :
            web_path : ~

    filter_sets :
        cache : ~

        # the name of the "filter set"
        my_thumb :

            # adjust the image quality to 75%
            quality : 75

            # list of transformations to apply (the "filters")
            filters :

                # create a thumbnail: set size to 120x90 and use the "outbound" mode
                # to crop the image when the size ratio of the input differs
                thumbnail  : { size : [120, 90], mode : outbound }

                # create a 2px black border: center the thumbnail on a black background
                # 4px larger to create a 2px border around the final image
                background : { size : [124, 94], position : center, color : '#000000' }

You've now created a filter set called my_thumb that performs a thumbnail transformation. The thumbnail filter sizes the image to the desired width and height (in this example, 120x90px), and its mode: outbound option causes the resulting image to be cropped if the input ratio differs. The background filter results in a 2px black border by creating a black canvas 124x94px in size, and positioning the thumbnail at its center.

Note: A filter set can have any number of filters defined for it. Simple transformations may only require a single filter while complex transformations can have an unlimited number of filters defined for them.

There are a number of additional filters, but for now you can use your newly defined my_thumb filter set immediately within a template.

For Twig-based template, use:

<img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb') }}" />

Or, for PHP-based template, use:

<img src="<?php $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb') ?>" />

Behind the scenes, the bundle applies the filter(s) to the image on-the-fly when the first page request is served. The transformed image is then cached for subsequent requests. The final cached image path would be similar to /media/cache/my_thumb/relative/path/to/image.jpg.

Note: *Using the dev environment you might find that images are not properly rendered via the template helper. This is often caused by having intercept_redirect enabled in your application configuration. To ensure images are rendered, it is strongly suggested to disable this option:

# app/config/config_dev.yml

web_profiler :
    intercept_redirects : false

Runtime Options

Sometime, you may have a filter defined that fulfills 99% of your usage scenarios. Instead of defining a new filter for the erroneous 1% of cases, you may instead choose to alter the behavior of a filter at runtime by passing the template helper an options array.

For Twig-based template, use:

{% set runtimeConfig = {"thumbnail": {"size": [50, 50] }} %}

<img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb', runtimeConfig) }}" />

Or, for PHP-based template, use:

<?php
$runtimeConfig = array(
    "thumbnail" => array(
        "size" => array(50, 50)
    )
);
?>

<img src="<?php $this['imagine']->filter('/relative/path/to/image.jpg', 'my_thumb', $runtimeConfig) ?>" />

Path Resolution

Sometime you need to resolve the image path returned by this bundle for a filtered image. This can easily be achieved using Symfony's console binary or programmatically from within a controller or other piece of code.

Resolve with the Console

You can resolve an image URL using the console command liip:imagine:cache:resolve. The only required argument is one or more relative image paths (which must be separated by a space).

$ php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg relative/path/to/image2.jpg

Additionally, you can use the --filter option to specify which filter you want to resolve for (if the --filter option is omitted, all available filters will be resolved).

$ php bin/console liip:imagine:cache:resolve relative/path/to/image1.jpg --filter=my_thumb

Resolve Programmatically

You can resolve the image URL in your code using the getBrowserPath method of the liip_imagine.cache.manager service. Assuming you already have the service assigned to a variable called $imagineCacheManager, you would run:

$imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');

Often, you need to perform this operation in a controller. Assuming your controller inherits from the base Symfony controller, you can take advantage of the inherited get method to request the liip_imagine.cache.manager service, from which you can call getBrowserPath on a relative image path to get its resolved location.

/** @var CacheManager */
$imagineCacheManager = $this->get('liip_imagine.cache.manager');

/** @var string */
$resolvedPath = $imagineCacheManager->getBrowserPath('/relative/path/to/image.jpg', 'my_thumb');

Filters

This bundle provides a set of built-in filters and you may easily define your own filters as well. Reference the filters chapter from our documentation.

Use as a Service

If you need to use your defined "filter sets" from within your controller, you can fetch this bundle's FilterService from the service container to do the heavy lifting for you.

<?php

class MyController extends Controller
{
    public function indexAction()
    {
        /** @var FilterService */
        $imagine = $this
            ->container
            ->get('liip_imagine.service.filter');

        // 1) Simple filter, OR
        $resourcePath = $imagine->getUrlOfFilteredImage('uploads/foo.jpg', 'my_thumb');
        
        // 2) Runtime configuration
        $runtimeConfig = [
            'thumbnail' => [
                'size' => [200, 200]
            ],
        ];
        $resourcePath = $imagine->getUrlOfFilteredImageWithRuntimeFilters(
            'uploads/foo.jpg',
            'my_thumb',
            $runtimeConfig
        );

        // ..
    }
}

?>

Data Roots

By default, Symfony's web/ directory is registered as a data root to load assets from. For many installations this will be sufficient, but sometime you may need to load images from other locations. To do this, you must set the data_root parameter in your configuration (often located at app/config/config.yml).

liip_imagine:
    loaders:
        default:
            filesystem:
                data_root: /path/to/source/images/dir

As of version 1.7.2 you can register multiple data root paths, and the file locator will search each for the requested file.

liip_imagine:
    loaders:
        default:
            filesystem:
                data_root:
                    - /path/foo
                    - /path/bar

As of version 1.7.3 you ask for the public resource paths from all registered bundles to be auto-registered as data roots. This allows you to load assets from the Resources/public folders that reside within the loaded bundles. To enable this feature, set the bundle_resources.enabled configuration option to true.

liip_imagine:
    loaders:
        default:
            filesystem:
                bundle_resources:
                    enabled: true

If you want to register some of the Resource/public folders, but not all, you can do so by blacklisting the bundles you don't want registered or whitelisting the bundles you do want registered. For example, to blacklist (not register) the bundles "FooBundle" and "BarBundle", you would use the following configuration.

liip_imagine:
    loaders:
        default:
            filesystem:
                bundle_resources:
                    enabled: true
                    access_control_type: blacklist
                    access_control_list:
                        - FooBundle
                        - BarBundle

Alternatively, if you want to whitelist (only register) the bundles "FooBundle" and "BarBundle", you would use the following configuration.

liip_imagine:
    loaders:
        default:
            filesystem:
                bundle_resources:
                    enabled: true
                    access_control_type: whitelist
                    access_control_list:
                        - FooBundle
                        - BarBundle

Permissions

Image locations must be readable by your web server. On a system that supports setfacl (such as Linux/BSD), use

HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`

sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX /path/to/source/images/dir

sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX /path/to/source/images/dir

See the Symfony Permissions documentation for commands compatible with macOS and other environments.

Using Apache

You need to grant read access for Apache by adding the following to your Apache VHost configuration

<VirtualHost *:80>
    <!-- Rest of directives like DocumentRoot or ServerName -->

    Alias /FavouriteAlias /path/to/source/images/dir
    <Directory "/path/to/source/images/dir">
        AllowOverride None
        Allow from All
    </Directory>
</VirtualHost>

Alternatively, you can place the directive in a separate file within your project, and include it within your Apache VHost configuration. For example, you can create the file app/config/apache/photos.xml and add the following to your VHost file

<VirtualHost *:80>
    <!-- Rest of directives like DocumentRoot or ServerName -->

    Include "/path/to/your/project/app/config/apache/photos.xml"
</VirtualHost>

This method keeps the file with the rest of your code, allowing you to change it easily or create different environment-dependent configuration files.

Once you have configured Apache properly, the relative path to an image with the following absolute path /path/to/source/images/dir/logo.png must be /FavouriteAlias/logo.png.

Documentation

For more detailed information about the features of this bundle, refer to the documentation.

liipimaginebundle's People

Contributors

adam187 avatar alexwilson avatar avalanche123 avatar cedricziel avatar dbu avatar digitalkaoz avatar fbourigault avatar franmomu avatar graundas avatar gregumo avatar gujkiefe avatar havvg avatar helios-ag avatar javiereguiluz avatar jmikola avatar lsmith77 avatar lstrojny avatar makasim avatar maximgubar avatar mbabker avatar michellesanver avatar mynameisbogdan avatar nicwortel avatar peter-gribanov avatar robfrawley avatar rpkamp avatar serdyuka avatar trsteel88 avatar warxcell avatar weaverryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liipimaginebundle's Issues

Fatal error: Allowed memory size of 33554432 bytes exhausted

I'm getting this error trying to get image thumb routes using LippImagineBundle. I'm using the base controller as service.

The problem is that it's inside a loop so this code could be executed 1000 times:

$imagemanagerResponse = $this->container->get('liip_imagine.controller')->filterAction($this->getRequest(),$ProjectsArray2[$i]['projectimage'],'thumb_80x80' );
$ProjectsArray2[$i]['projectimage'] = $imagemanagerResponse->headers->get('location');

Is there any option to avoid crash?

Create image cache from console command

I'm trying to create service that runs all filters on specific images, so the cache is created before a deploy get symlinked to production.

All I want to do is this:

$request = new Request();
$this->imagineController->filterAction($request, $path, $filter);

This works but when I call this on an image that has already cache stored it wants to create a redirect etc.. and it I get the following error :

ErrorException: Warning: strpos(): Empty delimiter in .. vendor/liip/imagine-bundle/Liip/ImagineBundle/Imagine/Cache/Resolver/WebPathResolver.php line 41

Is there a better way to create all cache images from console ?

Add Last-Modified header to response

For better front end performance on first request, response should be sent with Last-Modified header.

When implementing please add a check for 304 responses (Response#isNotModified).

Route "_imagine_filter" does not exist

Hello,

First thank you for this great Bundle.
after installig the bundle i' confronted to a problem that every time i have the exception Route "_imagine_filter" does not exist.

I've debuged and i've seen that in "Liip\ImagineBundle\Imagine\Cache\CacheManager" in the return value of the function "generateUrl" you call genarate router with :

$this->router->generate('_imagine_'.$filter, $params, $absolute)

so the router will search the route imagine_filter (in my case) and he don't find it.

Thank you

Using Symfony 2.0: Fatal error: Undefined class constant MAJOR_VERSION in LiipImagineExtension.php line 48

I recently updated LiipImagineBundle and this line causes a failure, I have to comment it out to get my site to run:

if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {

this throws the following error:

PHP Fatal error: Undefined class constant 'MAJOR_VERSION' in (my webroot)\vendor\bundles\Liip\ImagineBundle\Depend
encyInjection\LiipImagineExtension.php on line 48

Also, by my read of this code: does this mean that 2.0 users won't get the benefit of the cache clearer? That's really too bad :(

Rename services to follow the best practice and avoid clashes

Currently, all services are named imagine.*, which uses the same name than AvalancheImagineBundle. The first segment should be liip_imagine according to the best practice and would avoid name clashes between the two bundles (which could lead to unexpected behavior when using them together)

Images url gets redirected

Is it a correct behaviour to send a redirection in the filterAction ? Images are not shown as the request send a redirect. The problem only happened in dev environment:

In DEV (my image url is redirected):

  • Image with the src attr set to /app_dev.php/uploads/my_filter/filename.jpg is not showed as the request is redirected

In PROD (no problem):

  • Image with the src attr set to /uploads/my_filter/filename.jpg (notice the front controller is missing) works.

So is it a real bug or does i misuse someting ?

Does this PR has anything related to my problem ?

Cached image is never reloaded when source image changes

Take the following scenario :

  1. Put source image at app/data/foo.png.
  2. First time image loads in browser, displayed content is good.
  3. Then change content of app/data/foo.png.
  4. Reloaded image in browser still shows the old content instead of the new content.

Cached image should be generated based on the hash of the file + filter name for example.

Don't know if it's really an issue or if I should implement my own cache resolver extending WebPathResolver ?

As a quick fix I tried removing cached image after I change content, but I didn't get it : is ResolverInterface::remove() only callable from within ResolverInterface::resolve() (because of $targetPath) ? Isn't there other way to remove cached images one by one using the source path and the filter name ?

Ability to serve images from database or s3?

Hi,

I've got a setup where I cannot rely on user uploaded images being on disk, users upload images and I'm storing the file data and mimetype in the database, resizing them and then passing them along to s3.

Have you considered a similar approach?

Cheers

Using /media/cache/filter_name/{path} routes

I'm trying to load images through Javascript using the routes provided by the bundle. I have

_imagine:
    resource: .
    type:     imagine

In app/routing.yml and I am trying to access the /media/cache/filter_name/{path} route. If I try to access the route through production I get a ResourceNotFoundException. If I access the route through app_dev.php then the image is returned. Once I've accessed the route through the dev environment, it will then work for production for any image passed through {path}, not just the original image. Is there a configuration setting or something that I'm missing?

format & file extension

Сhange extension of file with modified format, and not just mime-type.
Example:

source file: /uploads/example.jpg
format: png
destination file: /cache/uploads/example.png

Rename the Twig filter

Using the same name than AvalancheImagineBundle means that both bundles are exclusive.

LoaderInterface:find should return an Image

This will allow us to load from anything (and not just file or stream).
This will also allow reusing of the loader elsewhere (I need it for my WatermarkFilterLoader for exemple)

Ensure valid format

Currently when outputting a profile that has no specified format, the bundle uses the file's extension, however it does not check if that extension ins actually a valid format, which causes breaks in the backend and broken images.

The bundle should validate the extension against known and compatible image output formats, and fall back to a specific format if it finda nothing valid. (FilterManager)

Resize and crop with cropping options

I've the following requirement in our app for image resizing and cropping:

  1. If an image exceeeds a given dimension, resize it's smallest side to this dimension
  2. Crop the resulting image, but with the option to specify the side on the image where to crop

So for example, when the maximum dimension is a rectangle with 250x250 (height/width) and the input image is
300x600, resize it to 250x498, and make it optional where to crop the resized image:

  1. crop the left side
  2. crop in the "middle"
  3. crop on the right

Is this possible with the current available filters?

If not, i'd be happy to send you a PR with this feature.

RelativeResize on width and height?

Can you have multiple filter?

  filters:
                #thumbnail: { size: [1142, 650], mode: inbound }
                relative_resize: { heighten: 650 }
                relative_resize: { widen: 1142 }

I try to scale a picture to fit in a height and width but without crop (one side can be shorter but not longer).

Exception is thrown when source image could not be found

When a path is matched by ImagineBundle, but the source image does not exist, instead of a 404, an exception is thrown, resulting in a HTTP 500 response. Basically any url that matches the configured imagine prefix does this, which would seem is a bad thing (especially if you like clean error logs).

Should I write a patch for this, or is this intended behaviour?

The `cache` option does not work at filter_sets level

In the configuration file, the following will work:

liip_imagine:
    cache: my_custom_cache

But this does not work:

liip_imagine:
    filter_sets:
        my_special_style:
            cache: my_custom_cache
            filters:
                my_custom_filter: { }

It will cause the following exception:

InvalidConfigurationException: Unrecognized options "cache" under "liip_imagine.filter_sets.liip_rasterize"

Outside directory

Hi,

I can't manage to keep my pictures outside the web root. As explained in the doc, I overrided the DataLoader service and defined a custom path: %kernel.root_dir%/data/uploads

I changed the config file accordingly, is this correct?

liip_imagine:
driver: gd
web_root: %kernel.root_dir%/data/uploads
data_root: %kernel.root_dir%/data/uploads
cache_prefix: /media/cache
cache: web_path
data_loader: filesystem
controller_action: liip_imagine.controller:filterAction
formats: []

Many thanks for this amazing bundle.

add support for dynamic filters

it should be possible for a dataloader to read the filter rules out along with the image and dynamically register it with the filter manager

aka one would register a filter set without including all the options. a custom data loader would then need. to have some way to find the config for the given image and dynamically set the filter config.

this means that the filter and data managers would need to have some sort of dependency.

Make cacheClearer an option

I just noticed that the Bundle now auto-hooks a cache clear on the standard Symfony Cache Clear command.

This is actually not something we want in our code, as images don't really need to be flushed and the overhead of "all" images being re-cached after every deploy is not desirable.

Is it possible to make this a configuration setting? like auto_cache_flush or something we can set to false and handle the image cache separately from the rest of the application cache?

Add support for several filters in one filter set

Currently in configuration we can specify only one filter in filter set. E.g.:

liip_imagine:
    filters:
        my_thumb:
            type:    thumbnail
            options: { size: [120, 90], mode: outbound }

We should allow specifiying several filters in one filter set (e.g. resize the image and add watermark). For example:

liip_imagine:
    filters:
        my_thumb:
            thumbnail:
                options: { size: [120, 90], mode: outbound }
            other_filter: ~
            other_filter2: ~

What do you think?

get filter from command

is it posible to get filter from comand line. for example i have command that post images to facebook and i want to appy filters, but i dond know how.

CacheClearerInterface not found

@sixty-nine made some changes recently to the cache clearer. are they dependent on Symfony 2.1? I'm on 2.0.12 and am getting the following error.

Fatal error: Interface 'Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface' not found in /xxx/vendor/bundles/Liip/ImagineBundle/Imagine/Cache/CacheClearer.php on line 13

My deps are the following:

[Imagine]
    git=http://github.com/avalanche123/Imagine.git
    target=imagine
    version=v0.2.0

[LiipImagineBundle]
    git=http://github.com/liip/LiipImagineBundle.git
    target=bundles/Liip/ImagineBundle

Thanks

liip_imagine.formats option - inacurate description / weird behaviour

In the docs we have:

formats - optional list of image formats to which images may be converted to.

Right now if this configuration option is not defined, no images will be generated. Instead we will get the following error:

Source image not found in "/images/file-name.jpg" 

This is because of https://github.com/liip/LiipImagineBundle/blob/master/Imagine/DataLoader/FileSystemLoader.php#L36-38

Defining liip_imagine.formats fixes the issue. Is this option required? What's the point of specifying this? If it's a filter to pass only images of specified format to imagine, shouldn't we check this in apply_filter, instead of generating errors? And support allow-all instead of deny-all setting by default?

Issue with default configuration

Using the default configuration example in the documentation, my pictures were not cached on my server.

Removing "cache:true" parameter fixed the issue.

This default value for this parameter should be "cache: my_web_path"

Bad Url when using "format"

I'm still trying to figure out the details on this one. But here is the scenario:

  1. My profile uses "format: jpg"
  2. I upload a png image
  3. I get a broken image and when inspecting that i get that it failed to "find source image"

So i looked into this.

  1. My template passes /url/to/image.png which is a real file and a real and valid url
  2. Twig function generates a url: cache/path/to/image.jpg (this would be the image that should be generated)
  3. Inspecting the filterAction, it never gets the original name with png so it never manages to generate a cache file

If i forcefully switch the url to png it runs, caches and no longer has any problems.

It seems to me like this force switch of extensions is making the bundle lose the reference to the original and what cache file it should generate. Any ideas on this?

Installing LiipImagineBundle for Symfony 2.1 using Composer

There don't seem to be instructions for installing this bundle using composer so I added

"liip/imagine-bundle": "*",

to my composer.json and updated. Everything went fine until I tried to register the bundle in appKernel.php with the line

new Liip\ImagineBundle\LiipImagineBundle(),

Php gives the error

Fatal error: Class 'Liip\ImagineBundle\LiipImagineBundle' not found in C:\xampp\htdocs\xxxx\Symfony\app\AppKernel.php on line 24

As far as I can see LiipImagineBundle is in the right place in the vendors folder. Anyone have any idea whats wrong? Thanks in advance.

Add support for processing images without file extension

To keep URLs short, I need to publicly expose images with only the body part of image filenames (i.e. no file extension in the name). When passing such images to the filter, it complains:
Saving image in "" format is not supported, please use one of the following extension: "gif", "jpeg", "png", "wbmp", "xbm"

It would be great if you could refactor the filter to offer a default output format (e.g. jpg) if none can be obtained from the original image path.

Access Bundle Functions from Controller

Hi I was wondering if it was possible to access the functions of this bundle from other parts of the application instead of just twig templates?
I don't know if it's already possible or not, but if it is could someone write up a quick tutorial?

I have actually been able to create my own service that brings in the cachemanager and uses the same filter function as the twig helper but for some reason it never actually saves the image I input into the cache. I can see it returns a file path and it works normally in a twig template but it doesn't work inside the controller.

Main reason I need this is that I'm uploading files using SWF and I need to generate a file path and also a thumbnail path so I figured I'd hit two birds with one stone and use the same generation profile for returning the thumbnail url via JSON and also on the template.

Any thoughts?

Removing manual image from cache

It would be greate if there is a service methode like deleteImage(OriginalPath); Which deletes this image from all caches if it exists. Or deleteImage(OriginalPath, 'thumbName'); For deleting a image in a special thumb config. And a Console command for clearing the image cache would be also good (So there is no need to delete the complete cache just the image cache).

Add support for 'last-modified' and 'etag' cache headers

The current caching implementation of LiipImagineBundle relies on the web server to possess writable disc space to "cache" processed images. I found some of the issues with this approach to be that there is no cache expiry available in case a filter is modified and that the web server might run out of disc space if many images are filtered.

As remedy, I've hacked up an implementation of 'last-modified' and 'etag' cache headers to be served by LiipImagineBundle. This allows for external caching techniques instead of relying on server-side storage. Feel free to merge this patch if of interest.

https://github.com/advancingu/LiipImagineBundle/commit/bd0f8cecead5da7815f04700410a6daecf3f20a5

Cannot dump definitions which have method calls.

I'm getting this exception when adding the LiipImagineBundle to my app. I'm on Symfony master, so my first guess would be the bundle is not compatible with master.

Can you confirm this, or should it also work with the latest Symfony version?

Memory leaks

Don't know is it a bundle issue or Imagine lib, recently I've added filter to page witch already had lots of images.

My whole VM with 512MB ram was killed by out of memory, should bundle / lib free resources after each thumbnail generation process ?

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.