From: vincent@cubedesigners.com Date: Sat, 20 Feb 2021 18:12:43 +0000 (+0000) Subject: wip #4240 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c59437f2d23314750948c5d83a7ae20a9b499ec1;p=cubeextranet.git wip #4240 @1.5 --- diff --git a/inc/ws/Util/class.ws.util.php b/inc/ws/Util/class.ws.util.php index 443e3bb69..e01544bfb 100644 --- a/inc/ws/Util/class.ws.util.php +++ b/inc/ws/Util/class.ws.util.php @@ -78,7 +78,7 @@ class wsUtil return $res; } - public static function excelToArrayKeyVars($excelFile, $reader = 'Excel2007') + public static function excelToArrayKeyVars($excelFile, $reader = 'Excel2007', $skipEmptyId = false) { $worksheets = self::excelToArray($excelFile, false, $reader); $res = []; @@ -99,6 +99,9 @@ class wsUtil } $id = trim($line[0]); if ($id === '') { + if ($skipEmptyId) { + continue; + } $id = $i; } $res[$id] = $r; diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index b5eefec41..58434ea76 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -431,7 +431,7 @@ class wsHTML5Compiler $cdir = $this->wdir . '/commerce/'; $file = $cdir . $this->book->parametres->basketReferences; - $this->config->basketReferences = wsUtil::excelToArrayKeyVars($file); + $this->config->basketReferences = wsUtil::excelToArrayKeyVars($file, 'Excel2007', true); $odir = $cdir . '/opt/'; if (!file_exists($odir)) { @@ -456,12 +456,16 @@ class wsHTML5Compiler if (!$ean) { continue; } + if (!isset($this->config->basketReferences[$ean])) { + continue; + } $f = $file->getPathname(); if ($ext === 'mp4') { + $n = $ean . '-360.mp4'; $this->config->basketReferences[$ean]['360'] = true; - $opt = $odir . '/' . $ean . '-360.mp4'; + $opt = $odir . '/' . $n; if (!file_exists($opt) || !filesize($opt) || filemtime($opt) < filemtime($f)) { // Optimize original video `ffmpeg -i $f -filter:v scale=360:-2 -vcodec libx264 -an $opt`; @@ -472,18 +476,18 @@ class wsHTML5Compiler } else if (in_array('angle', $e)) { $type = 'angle'; } + $n = $ean . '-' . $type . '.jpg'; $this->config->basketReferences[$ean][$type] = true; - $opt = $odir . '/' . $ean . '-' . $type . '.jpg'; + $opt = $odir . '/' . $n; if (!file_exists($opt) || !filesize($opt) || filemtime($opt) < filemtime($f)) { // Optimize original image $convert = new CubeIT_Image_Resizer_ImageMagick(); $convert->loadImage($f); - $convert->resize(1080, null, 'ratio', false, 'C', 'M', 'ffffff'); - $convert->output('jpg', $f, 75); + $convert->resize(1080, null, 'ratio', false, 'C', 'M', 'white'); + $convert->output('jpg', $opt, 75); } } - - + $this->vdir->copy($opt, 'data/commerce/' . $n); } }