Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PasteFilterLoader #95

Closed
wants to merge 1 commit into from
Closed

Added PasteFilterLoader #95

wants to merge 1 commit into from

Conversation

lmcd
Copy link

@lmcd lmcd commented Nov 7, 2012

Added a filter loader for the 'Paste' filter. I really think there ought to be loaders for all the in-built Imagine filters so everything works out the box.

Example configuration for adding a watermark to an image:

liip_imagine:
    filter_sets:
        product_image:
            quality: 90
            filters:
                paste: { start: [577, 375], image: web/img/watermark.png }

P.S. bundle is a life-saver! Thx!

list($x, $y) = $options['start'];
$destImage = $this->imagine->open($this->rootPath.'/../'.$options['image']);

$filter = new Paste($destImage, new Point($x, $y));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can jut call $image->paste(), without using an extra filter object

@avalanche123
Copy link
Owner

Actually, looks like you misunderstood the interface. You need to prepare a filter in filter loader, not apply it, but just return it. In your case, you should open image that is specified in the options and return paste filter instance passing that image and point in constructor

@avalanche123
Copy link
Owner

Looks like you are submitting something for a different imagine bundle, configuration is not what this bundle expects

@lmcd
Copy link
Author

lmcd commented Nov 7, 2012

Whoops, looks like this code was intended for LiipImagineBundle which does return the image. Are there any real benefits to using LiipImagineBundle over AvalancheImagineBundle?

@avalanche123
Copy link
Owner

I don't understand your question, you clearly picked LiipImagineBundle for some reason :)

@lmcd
Copy link
Author

lmcd commented Nov 7, 2012

Was searching knpbundles for something to scale images on the fly (without prior knowledge of Imagine). Stumbled on LiipImagineBundle, read through the documentation and examples and it seemed to fit my requirements perfectly.

Comparing the two, they seem largely similar (LiipImagineBundle being a fork and all). LiipImagineBundle claims extensibility as the reason for it's existence but I'm curious how exactly it differs. Also wondering if FilterLoaders are incompatible by design.

@avalanche123
Copy link
Owner

My subjective summary would be that AvalancheImagineBundle is the minimalistic core to build on top of

@lmcd
Copy link
Author

lmcd commented Nov 7, 2012

Ah, I found the refactoring debate here: #25
It's a shame FilterLoaders are incompatible between the two, or I'd create a whole set of them :(

Bluestart83 pushed a commit to Bluestart83/AvalancheImagineBundle that referenced this pull request Jun 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants