From b6681e0fed2e50b92bd2f69ddbc5156a844dbcb1 Mon Sep 17 00:00:00 2001 From: Laurent Laffont <llaffont@afi-sa.fr> Date: Wed, 24 Jul 2019 17:06:45 +0200 Subject: [PATCH] article, library and album thumbnails to 500x500px bestfit --- VERSIONS_HOTLINE/95486 | 1 + library/Class/Album.php | 2 +- library/Class/AlbumRessource.php | 2 +- library/Class/Bib.php | 2 +- library/Class/Notice/Thumbnail/ProviderLocal.php | 2 +- library/startup.php | 1 + .../application/modules/admin/controllers/CmsControllerTest.php | 2 +- tests/library/Class/ArticleTest.php | 2 +- tests/library/Class/NoticeTest.php | 2 +- tests/library/Class/WebService/VignetteTest.php | 2 +- 10 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 VERSIONS_HOTLINE/95486 diff --git a/VERSIONS_HOTLINE/95486 b/VERSIONS_HOTLINE/95486 new file mode 100644 index 00000000000..c6ed628c640 --- /dev/null +++ b/VERSIONS_HOTLINE/95486 @@ -0,0 +1 @@ + - ticket #95486 : articles, albums, fiches bibliothèque: les vignettes générées sont maintenant en 500px \ No newline at end of file diff --git a/library/Class/Album.php b/library/Class/Album.php index 32a3c9a1694..de8d4e8ab35 100644 --- a/library/Class/Album.php +++ b/library/Class/Album.php @@ -739,7 +739,7 @@ class Class_Album extends Storm_Model_Abstract { try { $image = new Imagick($this->getVignettePath()); - $image->thumbnailImage(300, 0); + $image->thumbnailImage(THUMBNAIL_FIT_WIDTH_HEIGHT, THUMBNAIL_FIT_WIDTH_HEIGHT, true, false); if (!$image->writeImage($this->getThumbnailPath())) { $this->addError('Erreur lors de l\'enregistrement de la vignette'); diff --git a/library/Class/AlbumRessource.php b/library/Class/AlbumRessource.php index 9912bf5c92c..351df03add2 100644 --- a/library/Class/AlbumRessource.php +++ b/library/Class/AlbumRessource.php @@ -318,7 +318,7 @@ class Class_AlbumRessource extends Storm_Model_Abstract { try { $image = $this->getImage(); - $image->thumbnailImage(160, 0); + $image->thumbnailImage(THUMBNAIL_FIT_WIDTH_HEIGHT, THUMBNAIL_FIT_WIDTH_HEIGHT, true, false); if (!$image->writeImage($this->getThumbnailPath())) { $this->addError($this->_('Erreur lors de l\'enregistrement de la vignette')); diff --git a/library/Class/Bib.php b/library/Class/Bib.php index 14abc2dc82e..d56f1f411a7 100644 --- a/library/Class/Bib.php +++ b/library/Class/Bib.php @@ -845,7 +845,7 @@ class Class_Bib extends Storm_Model_Abstract { try { $image = self::getImageFactory($this->getBasePath() . $this->getFile()); - $image->thumbnailImage(160, 0); + $image->thumbnailImage(THUMBNAIL_FIT_WIDTH_HEIGHT, THUMBNAIL_FIT_WIDTH_HEIGHT, true, false); if (!$image->writeImage($this->getThumbnailPath())) { $this->addError('Erreur lors de l\'enregistrement de la vignette'); diff --git a/library/Class/Notice/Thumbnail/ProviderLocal.php b/library/Class/Notice/Thumbnail/ProviderLocal.php index 4d14b3f3619..0f041bd68ec 100644 --- a/library/Class/Notice/Thumbnail/ProviderLocal.php +++ b/library/Class/Notice/Thumbnail/ProviderLocal.php @@ -32,7 +32,7 @@ class Class_Notice_Thumbnail_ProviderLocal $filename = $this->_record->getClefAlpha().'.jpg'; - $image->thumbnailImage(160, 220, true, true); + $image->thumbnailImage(THUMBNAIL_FIT_WIDTH_HEIGHT, THUMBNAIL_FIT_WIDTH_HEIGHT, true, false); try { $image->writeImage($this->_getPath($filename)); diff --git a/library/startup.php b/library/startup.php index bd60f174571..3b136b53fc4 100644 --- a/library/startup.php +++ b/library/startup.php @@ -138,6 +138,7 @@ class Bokeh_Engine { defineConstant('MEMCACHED_PORT', '11211'); defineConstant('IMAGE_MAGICK_PATH', 'convert'); + defineConstant('THUMBNAIL_FIT_WIDTH_HEIGHT', '500'); defineConstant('PATCH_PATH', ROOT_PATH . '/cosmogramme/sql/patch/'); return $this; diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 02462f84361..6e49b08209c 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -932,7 +932,7 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer $image = $this->mock() ->whenCalled('thumbnailImage') - ->with(160, 220, true, true) + ->with(500, 500, true, false) ->answers(null) ->whenCalled('writeImage') diff --git a/tests/library/Class/ArticleTest.php b/tests/library/Class/ArticleTest.php index 5f2fd33fdaa..7f4f617588e 100644 --- a/tests/library/Class/ArticleTest.php +++ b/tests/library/Class/ArticleTest.php @@ -1105,7 +1105,7 @@ class ArticleIndexAllTest extends ModelTestCase { $image = $this->mock() ->whenCalled('thumbnailImage') - ->with(160, 220, true, true) + ->with(500, 500, true, false) ->answers(null) ->whenCalled('writeImage') diff --git a/tests/library/Class/NoticeTest.php b/tests/library/Class/NoticeTest.php index d103fa05efa..4c21255d917 100644 --- a/tests/library/Class/NoticeTest.php +++ b/tests/library/Class/NoticeTest.php @@ -344,7 +344,7 @@ class NoticeVignetteTest extends ModelTestCase { ->beStrict()); $image = $this->mock() ->whenCalled('thumbnailImage') - ->with(160, 220, true, true) + ->with(500, 500, true, false) ->answers(null) ->whenCalled('writeImage') diff --git a/tests/library/Class/WebService/VignetteTest.php b/tests/library/Class/WebService/VignetteTest.php index f9967bfdf6d..768f97aaa21 100644 --- a/tests/library/Class/WebService/VignetteTest.php +++ b/tests/library/Class/WebService/VignetteTest.php @@ -142,7 +142,7 @@ class Class_WebService_VignetteWrongFrbrTest extends ModelTestCase { $image = $this->mock() ->whenCalled('thumbnailImage') - ->with(160, 220, true, true) + ->with(500, 500, true, false) ->answers(null) ->whenCalled('writeImage') -- GitLab