prestashop - custom image size defined by theme
-
24-12-2019 - |
Question
It is any option/code to define/change image sizes by theme so it will be in the list in back-office when the theme is applied?
I'm creating new theme for which i need to add/modify some image sizes and will be much easier if that can be defined inside the theme instead of manually defining that in back-office every-time the theme is applied.
I've spent some time googling but no luck ;-(
Solution
There's config.xml file that the "themeinstallator" module is using, when installing a theme.
Let's say that you have zip file of your theme with the following filesystem:
/modules/*.*
/themes/yourtheme/*.*
/config.xml
In the main folder you must have config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<theme version="1.0" name="yourtheme" directory="yourtheme">
<images>
<image name="small_default" width="71" height="71" products="true" categories="true" manufacturers="true" suppliers="true" scenes="false"/>
....
</images>
</theme>
The attributes and values correspond to the ones from the BackOffice > Preferences -> Images page.
The easiest way to do that is just to export the theme via the "themeinstallator".