From: vincent@cubedesigners.com Date: Fri, 26 Nov 2021 10:09:45 +0000 (+0000) Subject: wait #4915 @0:20 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=662890ae1649e56e9a487a14df623ab00b2dd646;p=cubeextranet.git wait #4915 @0:20 --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index e33fc20b0..13dd570ef 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -209,7 +209,7 @@ class wsFlash extends cubeFlashGateway $fname = $this->args['fieldname'] . '_' . cubeFiles::tidyName($infos['name']); $tmp = sys_get_temp_dir() . '/' . $fname; - move_uploaded_file($infos['tmp_name'],$tmp); + move_uploaded_file($infos['tmp_name'], $tmp); $api = new ws3API(); $api->uploadThemeFile($this->args['theme_id'], $this->args['fieldname'], $tmp); @@ -601,19 +601,31 @@ class wsFlash extends cubeFlashGateway $pages = $dao->getPagesOfBook($this->args['book_id']); $nb_pages = count($pages); + $pagesFiles = []; $daoDoc = new wsDAODocument($core->con); - $maxWidth = 0; $maxHeight = 0; - foreach ($pages as $page) { - $doc = $daoDoc->selectById($page['document_id']); - $size = $doc->generalInfos['page'][$page['document_page']]['size']; - $maxWidth = max($size[0], $maxWidth); - $maxHeight = max($size[1], $maxHeight); - break; + $docs = []; + + foreach ($pages as $p => $page) { + if (!isset($docs[$page['document_id']])) { + $docs[$page['document_id']] = $daoDoc->selectById($page['document_id']); + } + /** @var wsDocument $doc */ + $doc = $docs[$page['document_id']]; + + + $pagesFiles[$p] = $doc->getFile($page['document_page'], 'jpg', 150, true, true, 'html'); + + if ($p == 1) { + $size = $doc->generalInfos['page'][$page['document_page']]['size']; + $maxWidth = max($size[0], $maxWidth); + $maxHeight = max($size[1], $maxHeight); + } + } $maxWidth = round($maxWidth * 20) / 20; $maxHeight = round($maxHeight * 20) / 20; @@ -640,6 +652,7 @@ class wsFlash extends cubeFlashGateway $this->jsonDatas['mobileFirst'] = $book->parametres->mobileNavigationType === 'mobilefirst'; $this->jsonDatas['links'] = $links; $this->jsonDatas['rulers'] = $rulers; + $this->jsonDatas['pagesFiles'] = $pagesFiles; } else { $l = json_encode($links); $l = html::escapeHTML($l); @@ -650,6 +663,7 @@ class wsFlash extends cubeFlashGateway $this->xml->addChild('mobileFirst', $book->parametres->mobileNavigationType === 'mobilefirst'); $this->xml->addChild('links', $l); $this->xml->addChild('rulers', json_encode($rulers)); + $this->xml->addChild('pagesFiles', json_encode($pagesFiles)); } $daoTheme = new wsDAOTheme($this->con);