Prestashop and ImageKit

templates/catalog/listing/category.tpl templates/catalog/_partials/product-cover-thumbnails.tpl templates/catalog/_partials/product-images-modal.tpl templates/catalog/_partials/miniatures/product.tpl modules/ps_imageslider/views/templates/hook/slider.tpl
templates/catalog/_partials/miniatures/product.tpl
<img 
src="{$product.cover.bySize.home_default.url}"
alt="{if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{/if}"
data-full-size-image-url="{$product.cover.large.url}"
/>
src="https://ik.imagekit.io/ourimagekitid{parse_url($product.cover.bySize.home_default.url, PHP_URL_PATH)}"
src="https://ik.imagekit.io/ourimagekitid/tr:w-250,h-250{parse_url($product.cover.bySize.home_default.url, PHP_URL_PATH)}"
public function install() 
{
Configuration::updateValue('IMAGEKIT_LIVE_MODE', false); return parent::install() && $this->registerHook('actionDispatcher') && $this->registerHook('backOfficeHeader');
}
public function hookBackOfficeHeader() 
{
if (Tools::getValue('configure') == $this->name || Tools::getValue('module_name') == $this->name)
{
$this->context->controller->addJS($this->_path.'views/js/back.js');
}
}
public function hookActionDispatcher()
{
$this->context->smarty->registerPlugin('function', 'imagekit', array('Imagekit', 'imagekitUrl'));
}
public static function imagekitUrl($params,$smarty) {
if ($params['url']) {
if ( Configuration::get('IMAGEKIT_LIVE_MODE', false) && Configuration::get('IMAGEKIT_ENDPOINT', '')) {
$tr = $params['tr'] ? 'tr:'.$params['tr'] : '';
$v = $params['v'] ? '?'.Configuration::get('IMAGEKIT_TS', '') : '';
return Configuration::get('IMAGEKIT_ENDPOINT', '') . $tr . parse_url($params['url'],PHP_URL_PATH) . $v;
}
return $params['url'];
}
return '';
}
src = "{imagekit tr='w-250,h-250' url=$product.cover.bySize.home_default.url}"
/img/c/25.jpg
/img/c/25.jpg?1623440107030
<img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite,$subcategory.id_image,'')}" alt="{$subcategory.name|escape:'html':'UTF-8'}"/>
<img class="replace-2x" src="{imagekit tr='w-230,h-230' v=1 url=$link->getCatImageLink($subcategory.link_rewrite,$subcategory.id_image,'')}" alt="{$subcategory.name|escape:'html':'UTF-8'}"/>
<img class="replace-2x" 
{if function_exists("imagekitUrl")}
src="{imagekit tr='w-230,h-230' v=1 url=$link->getCatImageLink($subcategory.link_rewrite,$subcategory.id_image,'')}"
{else}
src="{$link->getCatImageLink($subcategory.link_rewrite,$subcategory.id_image,'')}"
{/if}
/>

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kotlin vs Java | Which is the Best Language for Android Development?

Turing Machines and the Limits of Computers

Jenkins DevKit: Automating Jenkins 2

Sinatra Project

Designing a Bandpass Finite Impulse Response (FIR) Filter in Matlab

How to perform skull stripping using matlab?

Parallel testing: get feedback earlier, release faster

How to design multirate filter system for EMG signals

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Valentine Kulikov

Valentine Kulikov

More from Medium

The C in the FGC

PHP basic OOP Visibility to Polymorphism

What Happens When You Type https://www.google.com In Your Browser And Press Enter