Jump to content

Manufacturer and Brand images in WEBP format


_Veronika_

Recommended Posts

Hi everyone

I'm trying to make a code modification so that the brand images are also in webp format but I can't get it to work. The products are working fine as I have them configured but I haven't found a way to make it work for brands.

Could someone guide me on how to do this? I haven't found an answer to this on the forum yet. Im using PS 8.1.5

Link to comment
Share on other sites

Hi @Prestashop Addict

If I open webmasters tools and I change in elements the format of the file .jpg to .webp I can see the logo in the format .webp, but the code of the file is not setted to show the new format webp. I show you the code by default in miniatures/brand.tpl

{block name='brand_miniature_item'}
  <li class="brand">
    <div class="brand-img"><a href="{$brand.url}"><img src="{$brand.image}" alt="{$brand.name}" loading="lazy"></a></div>
    <div class="brand-infos">
      <p><a href="{$brand.url}">{$brand.name}</a></p>
      {$brand.text nofilter}
    </div>

but miniatures/category.tpl show the webp with this code by default

{block name='category_miniature_item'}
  <section class="category-miniature">
    <a href="{$category.url}">
      <picture>
        {if !empty($category.image.medium.sources.avif)}<source srcset="{$category.image.medium.sources.avif}" type="image/avif">{/if}
        {if !empty($category.image.medium.sources.webp)}<source srcset="{$category.image.medium.sources.webp}" type="image/webp">{/if}
        <img
          src="{$category.image.medium.url}"
          alt="{if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if}"
          loading="lazy"
          width="250"
          height="250"
        >
      </picture>
    </a>

this works perfect for the categories but I cant do it work in the brands

Link to comment
Share on other sites

Im checking in Chrome because I dont use Firefox and in sources tab all images I can see are .jpg (2-small_default.jpg, 3-small_default.jpg...) No .webp for brand logos or in brand pages, Im using Prestashop 8.1.5 and theme Classic 2.1.3 (the last version)

Link to comment
Share on other sites

il y a 38 minutes, _Veronika_ a dit :

I know it, but the other option (default setting) dont work to me. I dont have product nor categories in webp if I dont use the experimental

I dont' really undertand your issue, if you select as I explained Use webp for all images, any format uploaded will be converted to webp 🙂 

Edited by Prestashop Addict (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hello @Prestashop Addict

I told my server what is happening because I don't see the .webp format so I thought could be a problem with the configuration in the server. And what I have been told is that feature is not experimental for some versions ago, it is fully integrated as a new feature of Prestashop.

And after this answer I looked at it and they are correct, the option I have activated is not experimental anymore. So this issue is resolved.

But the main issue for which I opened this topic, how to put the pics of the brands on webp just like the photos of products and categories, is still open.

Could anyone give me any idea how to do it? Thanks in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...