Reputation: 2982
I've got an image on our website that we've had to change as it was a .ico image which isn't widely supported on browsers like google chrome. It was also quiet large so it needed reducing in size. So we've changed the image to info-icon.png rather then server-image.ico.
So, now that we have changed that, run the following commands:
php app/console assetic:dump --env=prod --no-debug
php app/console assets:install ../web --env=prod --no-debug
php app/console cache:clear --env=prod --no-debug
php app/console cache:warmup --env=prod --no-debug
All have come back fine and haven't reported any issues. When we go to our website and look at the source code we can see that the image url has changed to info-icon.png however the link is a 404 error code. The twig code for the image is below:
{% image output="/images/info-icon.png"
'@MyBundle/Resources/public/images/info-ico.png'
%}
<img src="{{ asset_url }}" alt="">
{% endimage %}
P.s. The image name is info-ico.png it isn't a typo we wanted to show the image as a different name. This is also in production mode.
If anyones interested this is the code for the assetic config:
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ 'MyBundle' ]
node: /usr/bin/nodejs
#java: /usr/bin/java
filters:
cssrewrite: ~
uglifycss:
bin: /usr/local/lib/node_modules/uglifycss/uglifycss
no_copyright: true
#apply_to: ['.css$']
uglifyjs2:
bin: /usr/local/lib/node_modules/uglify-js/bin/uglifyjs
no_copyright: true
#apply_to: ['.js$']
optipng:
bin: /usr/bin/optipng
apply_to: "\.png$"
jpegtran:
bin: /usr/bin/jpegtran
apply_to: ['.jpe?g$']
progressive: true
I've also tried clearing the cache manually, using a symlink on the assets:install command and nothing seems to work. Has anyone got any idea's?
Upvotes: 2
Views: 544
Reputation: 2982
The issue was with the assetic:dump command and mis-configuration.
I was running the command with the --no-debug so I couldn't see what was happening however I was getting random characters appearing when running this command. The command was outputting the PNG encoding as the modules for optimising the jpeg's and PNG images were not installed on the production server so simply removing these from the config file and then clearing the cache and warming up the cache. I then run the assetic:dump command again which resolved the issue.
Upvotes: 1