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

Output tag #10

Closed
fergardi opened this issue Dec 10, 2013 · 1 comment
Closed

Output tag #10

fergardi opened this issue Dec 10, 2013 · 1 comment

Comments

@fergardi
Copy link

Hello.

I'm having problems in order to set the default output path for assetic to jpegoptim images.

According to the official cookbook documentation, we must use:

filters:
    jpegoptim:
      bin: usr/bin/jpegoptim
      apply_to: "\.jpg$"
      strip_all: true
      max: 70
  twig:
    functions:
      jpegoptim: { output: myfolder/*.jpg }

And then call the function in a twig template as usual like:

<img class='image' src='{{ jpegoptim('bundles/mybundle/images/myimage.jpg') }}' alt='Image'>

But this doesn't work. The image assets go to my assetic/ folder instead.

However, if I use the alternate single-use with no configutarion tags:

{% image 'bundles/mybundle/images/myimage.jpg'
    filter='jpegoptim' output='/myfolder/myimage.jpg' %}
    <img src="{{ asset_url }}" alt="Image"/>
{% endimage %}

Then it works perfectly. The bad thing is that I need to specify the output folder in EVERY single image. What's the point of the configuration output tag then? I'm doing it wrong?

Thank you in advance.

@mfdj
Copy link

mfdj commented Jan 18, 2014

This issue can be closed here: it is almost certainly only applicable to the AsseticBundle (as referenced above)

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

No branches or pull requests

3 participants