Jump to content

Subcategory.id > Webp


Recommended Posts

Hello,

I am in the process of integrating webp everywhere on my prestashop from a personalized folder. However, I have a problem with a variable.

Access folder webp / sc / ($subcategory.id or $subcategory.id_category)_cover.webp.
 Example file name: 1_cover.webp)

Access to the image is denied. the loaded image is always in jpg format.

{if $subcategory.image}
{assign var="webp" value="webp/sc/{$subcategory.id_category}_cover.webp"}
	{if file_exists($webp)} 
		<img data-src="{$urls.base_url}webp/sc/{$subcategory.id_category}_cover.webp" alt="{if !empty($subcategory.image.legend)}{$subcategory.image.legend}{else}			{$subcategory.name}{/if}" type="image/webp" class="lazyload" >
	{else} 
		<img data-src="{$subcategory.image.bySize.subcategory_product.url}" alt="{if !empty($subcategory.image.legend)}{$subcategory.image.legend}{else}			{$subcategory.name}{/if}" class="lazyload">
	{/if}
	{else}
	<img class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==">
{/if}

 

Edited by [email protected] (see edit history)
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...