From 471cc4ee21e965b505b8664b3bf88b62fe54380a Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 3 Jan 2013 13:47:55 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.services.php | 28 ++++++++++------------ inc/ws/Metier/class.ws.book.parametres.php | 4 +++- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 01d3d3898..ffc3b7a4e 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -45,7 +45,6 @@ class wsServices extends cubeFlashGateway { } $bookmarks = json_decode(base64_decode($this->args['bookmarks']), true); - fb($bookmarks); $files = array(); foreach ($bookmarks as $b) { $range = $b['page']; @@ -145,26 +144,23 @@ class wsServices extends cubeFlashGateway { public function facebook_thumbnail() { $this->outputXML = false; $dao = new wsDAOBook($this->con); - $pages = $dao->getPagesOfBook($this->args['id']); - $dest = WS_CACHE . '/thumbnails/' . $this->args['id'] . '_' . $pages[1]['document_id'] . '_' . $pages[1]['document_page'] . '.jpg'; - $cover = WS_DOCS . '/' . $pages[1]['document_id'] . '/p' . $pages[1]['document_page'] . '.jpg'; + $book = $dao->selectById($this->args['id']); - if (!file_exists($dest) || filemtime($dest) < filemtime($cover)) { - $it = new imageTools(); - $ratio = $it->getW() / $it->getH(); - $method = 'ratio'; - if ($ratio > 3 || (1 / $ratio) > 3) { - $method = 'crop'; - } - - $it->loadImage($cover); - $it->resize(141, 200, $method, true); - $it->output('jpeg', $dest, 100); + if (isset($book->parametres->facebook_image) && $book->parametres->facebook_image != '') { + $c = WS_BOOKS . '/working/' . $this->args['id'] . '/' . $book->parametres->facebook_image; + if (file_exists($c)) { + $cover = $c; + } } + if (!isset($cover)) { + $pages = $dao->getPagesOfBook($this->args['id']); + $cover = WS_DOCS . '/' . $pages[1]['document_id'] . '/p' . $pages[1]['document_page'] . '.jpg'; + } + - cubeHTTP::relayFile($dest); + cubeHTTP::relayFile($cover); exit; } diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 7260e2e80..9f3ce1b50 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -54,6 +54,8 @@ class wsBookParametres extends wsParametres { $this->fields['facebook'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Facebook')); $this->fields['facebook_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre facebook"), 'hint' => __('Titre proposé sur la fonction de partage facebook (par défaut, titre de la publication)')); $this->fields['facebook_description'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Description facebook"), 'grade' => 1, 'hint' => __('Description proposée sur la fonction de partage facebook (par défaut, vide)')); + $this->fields['facebook_image'] = array('type' => 'freefile', 'default' => '', 'editable' => true, + 'label' => __('Miniature affichée'), 'fileFilter' => $imageFilter); $this->fields['twitter'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Twitter')); $this->fields['twitter_description'] = array('type' => 'textarea', 'default' => '%title% : %short%', 'editable' => true, 'label' => __("Contenu Twitter"), 'hint' => __('Contenu du Twit')); $this->fields['customSharer'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Classe personnalisée de partage"), 'grade' => 5); @@ -61,7 +63,7 @@ class wsBookParametres extends wsParametres { $this->fields['friendHeight'] = array('type' => 'integer', 'default' => 500, 'editable' => true, 'label' => __('Largeur du menu'), 'grade' => 5); $this->forms['share'] = array('label' => __('Fonctions de partage'), 'fieldsnames' => array('friend', 'email_title', 'email_body', 'email_editable', 'askAcknowledge', '|', - 'facebook', 'facebook_title', 'facebook_description', '|', + 'facebook', 'facebook_title', 'facebook_description', 'facebook_image', '|', 'twitter', 'twitter_description', '|', 'customSharer', '|', 'friendWidth', 'friendHeight')); // . $this->fields['pages'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Nombre de pages')); -- 2.39.5