35 lines
802 B
PHP
35 lines
802 B
PHP
<?php
|
|
|
|
class X13WebpAjaxModuleFrontController extends ModuleFrontController
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
parent::init();
|
|
|
|
if($x13images = (array)Tools::getValue('x13images')){
|
|
$this->convertImages($x13images);
|
|
}
|
|
}
|
|
|
|
|
|
public function convertImages($x13images)
|
|
{
|
|
if (Configuration::get($this->module->options_prefix . 'OPERATION_MODE') == 0) {
|
|
return;
|
|
}
|
|
|
|
foreach($x13images as $img){
|
|
|
|
$ext = pathinfo($img, PATHINFO_EXTENSION);
|
|
|
|
if (in_array($ext, $this->module->x13helper->getAvailableExtensions()) && !$this->module->x13helper->checkWebpExistsFromUrl($img)) {
|
|
|
|
$this->module->x13converter->convertWebpFromUrl($img);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|