From 2888307eb46f728ca2de511ad32757683b83919a Mon Sep 17 00:00:00 2001 From: Aske Ertmann Date: Sat, 22 Dec 2018 10:54:36 -0300 Subject: [PATCH 1/3] TASK: Compatibility with Flow 4.+ --- .../FilePreviewsThumbnailGenerator.php | 20 +++++++++---------- Classes/Service/ApiClient.php | 7 +++---- Classes/Service/Client.php | 4 +--- Configuration/Settings.yaml | 7 +++---- README.md | 20 ++++++++----------- composer.json | 6 +++--- 6 files changed, 27 insertions(+), 37 deletions(-) diff --git a/Classes/Domain/Model/ThumbnailGenerator/FilePreviewsThumbnailGenerator.php b/Classes/Domain/Model/ThumbnailGenerator/FilePreviewsThumbnailGenerator.php index 047d782..92611bd 100644 --- a/Classes/Domain/Model/ThumbnailGenerator/FilePreviewsThumbnailGenerator.php +++ b/Classes/Domain/Model/ThumbnailGenerator/FilePreviewsThumbnailGenerator.php @@ -4,7 +4,7 @@ /* * This file is part of the Ttree.FilePreviews package. * - * (c) ttree ltd - www.neos.io + * (c) ttree ltd - www.ttree.ch * * This package is Open Source Software. For the full copyright and license * information, please view the LICENSE file which was distributed with this @@ -13,16 +13,16 @@ use Ttree\FilePreviews\Service\ApiClient; use Ttree\FilePreviews\Service\FilePreviewsService; -use TYPO3\Flow\Annotations as Flow; +use Neos\Flow\Annotations as Flow; use Doctrine\ORM\Mapping as ORM; -use TYPO3\Flow\Resource\ResourceManager; -use TYPO3\Flow\Utility\Arrays; -use TYPO3\Media\Domain\Model\Thumbnail; -use TYPO3\Media\Domain\Model\ThumbnailGenerator\AbstractThumbnailGenerator; -use TYPO3\Media\Exception; +use Neos\Flow\ResourceManagement\ResourceManager; +use Neos\Utility\Arrays; +use Neos\Media\Domain\Model\Thumbnail; +use Neos\Media\Domain\Model\ThumbnailGenerator\AbstractThumbnailGenerator; +use Neos\Media\Exception; /** - * A system-generated preview version of a Document (PDF, AI and EPS) + * A system-generated preview version of a Document (DOCX, AI and EPS) */ class FilePreviewsThumbnailGenerator extends AbstractThumbnailGenerator { @@ -38,9 +38,7 @@ class FilePreviewsThumbnailGenerator extends AbstractThumbnailGenerator */ public function canRefresh(Thumbnail $thumbnail) { - return ( - $this->isExtensionSupported($thumbnail) - ); + return $this->isExtensionSupported($thumbnail); } /** diff --git a/Classes/Service/ApiClient.php b/Classes/Service/ApiClient.php index a40b143..2af5a85 100644 --- a/Classes/Service/ApiClient.php +++ b/Classes/Service/ApiClient.php @@ -4,16 +4,15 @@ /* * This file is part of the Ttree.FilePreviews package. * - * (c) ttree ltd - www.neos.io + * (c) ttree ltd - www.ttree.ch * * This package is Open Source Software. For the full copyright and license * information, please view the LICENSE file which was distributed with this * source code. */ -use TYPO3\Flow\Annotations as Flow; -use Doctrine\ORM\Mapping as ORM; -use TYPO3\Media\Exception; +use Neos\Flow\Annotations as Flow; +use Neos\Media\Exception; /** * File Previews Service diff --git a/Classes/Service/Client.php b/Classes/Service/Client.php index af87588..193e92b 100644 --- a/Classes/Service/Client.php +++ b/Classes/Service/Client.php @@ -4,7 +4,7 @@ /* * This file is part of the Ttree.FilePreviews package. * - * (c) ttree ltd - www.neos.io + * (c) ttree ltd - www.ttree.ch * * This package is Open Source Software. For the full copyright and license * information, please view the LICENSE file which was distributed with this @@ -12,8 +12,6 @@ */ use Guzzle\Http\Client as GuzzleClient; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Media\Exception; /** * File Previews Client Service diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 3308021..5db8766 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -1,7 +1,6 @@ -TYPO3: +Neos: Media: - thumbnailGenerator: - + thumbnailGenerators: 'Ttree\FilePreviews\Domain\Model\ThumbnailGenerator\FilePreviewsThumbnailGenerator': apiKey: 'api-key' apiSecret: 'api-secret' @@ -10,4 +9,4 @@ TYPO3: defaultOptions: format: 'jpg' retryInterval: 1 - supportedExtensions: [ 'doc', 'docx', 'txt', 'rtf', 'ogg' ] + supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps' ] diff --git a/README.md b/README.md index 1fbe2ad..a87fb6b 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,23 @@ -# Neos CMS filepreviews.io integration +# Neos CMS filepreviews.io integration -This package generate thumbnail and extract metadata from different type of document +This package generate thumbnail and extract metadata from different type of document based on the API of [filepreviews.io]. -**This package is under development and depends on change not currently available in a stable version of Neos** - This package is Composer ready, [PSR-2] and [PSR-4] compliant. How it work ? ------------- -This Generator call the FilePreviews.io API to generate Thumbnail for dozen of differents file format. Check [filepreviews.io] +This Generator call the FilePreviews.io API to generate Thumbnail for many different file formats. Check [filepreviews.io] website for more informations. -![Thumbnail from an OGG Vorbis File](https://dl.dropboxusercontent.com/s/775z6n54b4goyc6/2015-11-19%20at%2012.40.png) - Configuration ------------- Like any other Thumbnail Generator, you can change default settings. First step, you need to configure your API keys. ```yaml -TYPO3: +Neos: Media: thumbnailGenerator: @@ -32,10 +28,10 @@ TYPO3: defaultOptions: format: 'jpg' retryInterval: 1 - supportedExtensions: [ 'doc', 'docx', 'txt', 'rtf', 'ogg' ] + supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps' ] ``` -- ```supportedExtensions```: check the official documentation of FilePreviews [Supported Formats] and enjoy. +- ```supportedExtensions```: check the official documentation of FilePreviews [Supported Formats] and enjoy. - ```defaultOptions```: check the [API endpoint] documentation. Acknowledgments @@ -53,5 +49,5 @@ The MIT License (MIT). Please see [LICENSE](LICENSE.txt) for more information. [PSR-2]: http://www.php-fig.org/psr/psr-2/ [PSR-4]: http://www.php-fig.org/psr/psr-4/ [filepreviews.io]: http://filepreviews.io/ -[Supported Formats]: http://filepreviews.io/docs/features.html -[API endpoint]: http://filepreviews.io/docs/endpoints.html +[Supported Formats]: https://filepreviews.io/docs/features/ +[API endpoint]: https://filepreviews.io/docs/endpoints/ diff --git a/composer.json b/composer.json index 61a5a82..9359d4e 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,11 @@ { "name": "ttree/filepreviews", - "type": "typo3-flow-package", + "type": "neos-package", "license": "MIT", "description": "Neos CMS filepreviews.io integration to generate thumbnail and extract metadata", "require": { - "typo3/flow": "*", - "typo3/media": "*", + "neos/flow": ">4.0", + "neos/media": ">3.0", "guzzle/guzzle": "~3.9" }, "autoload": { From 7abed3ff18cfb5b62772e081bee8f79d779f7eb7 Mon Sep 17 00:00:00 2001 From: Aske Ertmann Date: Wed, 23 Jan 2019 13:50:15 -0500 Subject: [PATCH 2/3] TASK: Add .psd and .ai to list of default supported extensions --- Configuration/Settings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 5db8766..8821df4 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -9,4 +9,4 @@ Neos: defaultOptions: format: 'jpg' retryInterval: 1 - supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps' ] + supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps', 'psd', 'ai' ] From da306c49ccae99f9c932f18938afafc342a9ab1a Mon Sep 17 00:00:00 2001 From: Aske Ertmann Date: Wed, 23 Jan 2019 13:51:04 -0500 Subject: [PATCH 3/3] TASK: Adjust readme to default configuration --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a87fb6b..cbd2504 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Neos: defaultOptions: format: 'jpg' retryInterval: 1 - supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps' ] + supportedExtensions: [ 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlxs', 'odt', 'ott', 'odp', 'txt', 'rtf', 'eps', 'psd', 'ai' ] ``` - ```supportedExtensions```: check the official documentation of FilePreviews [Supported Formats] and enjoy.