This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Display an image on bundle with Ez5
expandshrink

Display an image on bundle with Ez5

Display an image on bundle with Ez5

Wednesday 22 January 2014 9:14:17 am - 4 replies

Hi !

I've a question on EZ5. I've a Bundle (MyBundle) and I put an image on my folder : MyBundle/Resources/public/assets/img/logoHeader.png
Then, on my template I write this :
{% image '@MyBundle/Resources/public/assets/img/logoHeader.png'%}
    <img src="{{ asset_url }}" alt="logo" class="img-responsive"/>
{% endimage %}
I open my terminal and I empty cache and assetic:dump. But my picture doesn't appear...

My picture is ok on my folder web/images
I don't see where's my problem...

Sorry my english isn't always good :P
Thx !!

Wednesday 22 January 2014 9:55:23 am

Hi Stéphane

I never used Assetic image twig tag, but if you don't use any filter, why don't you just do the following:

<img src="{{ asset( 'mybundle/assets/img/logoHeader.png' ) }}" alt="logo" class="img-responsive"/>

This is the most basic way of using assets (see Symfony documentation on this). Folder mybundle/ corresponds to your public/ folder of bundle MyBundle. It's automatically symlinked when you run the assets:install command.

Wednesday 22 January 2014 10:42:47 am

Quote from Jérôme Vieilledent :

It's automatically symlinked when you run the assets:install command.

Salut Jérôme.

Thx happy.gif Emoticon

If I run this command (php ezpublish/console assetic:install --env=dev), I've this :

[InvalidArgumentException]
Command "assetic:install" is not defined.
Did you mean this?
assets:install

--env=dev isn't supported ?

Modified on Wednesday 22 January 2014 10:43:24 am by Stéphane Savona

Wednesday 22 January 2014 10:46:50 am

You mistype the command, it's assets:install, not assetic:install blunk.gif Emoticon

Wednesday 22 January 2014 11:04:05 am

Yeah ! You rock happy.gif Emoticon

Thx Jérôme. It's ok happy.gif Emoticon

Stef

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from