Git Product home page Git Product logo

liipimaginebundle's Issues

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).

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?

Rename the Twig filter

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

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)

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.

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 ?

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

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?

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.

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?

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).

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?

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.

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.

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)

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?

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?

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"

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 ?

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.

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?

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 ?

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).

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?

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 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 :(

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.

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"

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

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?

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

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

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)

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 ?

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.