Jump to content

Edit History

Vinibch

Vinibch

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}

 

Vinibch

Vinibch

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: $ subcategory.id.

webp / sc / ($ subcategory.id) _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}

 

×
×
  • Create New...