DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:mediathumbnails

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:mediathumbnails [2021-04-02 00:23] – Prepared release v0.91 thomas-schaefer-nhplugin:mediathumbnails [2022-08-16 16:12] (current) – corrected formatting thomas-schaefer-nh
Line 6: Line 6:
 email      : thomas@hilbershome.de  email      : thomas@hilbershome.de 
 type       : syntax type       : syntax
-lastupdate : 2021-04-02 +lastupdate : 2021-05-24 
-compatible : 2020-07-29 "Hogfather"+compatible : Hogfather, Igor
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : images, media+tags       : images, media, mediamanager, thumbnail, odt, pdf
  
-downloadurl: https://github.com/ternite/dokuwiki-plugin-mediathumbnails/archive/v0.91.zip+downloadurl: https://github.com/ternite/dokuwiki-plugin-mediathumbnails/archive/v0.92.zip
 bugtracker : hhttps://github.com/ternite/dokuwiki-plugin-mediathumbnails/issues bugtracker : hhttps://github.com/ternite/dokuwiki-plugin-mediathumbnails/issues
 sourcerepo : https://github.com/ternite/dokuwiki-plugin-mediathumbnails sourcerepo : https://github.com/ternite/dokuwiki-plugin-mediathumbnails
Line 20: Line 20:
 screenshot_img :  screenshot_img : 
 ---- ----
 +
 +===== What's it for? =====
 +
 +This plugin will show thumbnail images for supported media files (ODT, DOCX, PPTX, PDF, JPG, etc.) within your wiki pages.
 +
 +In default settings, a click in the thumbnail will have your browser download the media file.
 +
 +And an error message will be shown by default in case a referenced media file does not contain a thumbnail (office files) or is an unsupported file type (see dependencies on how you might work around that).
  
 ===== Installation and Dependencies ===== ===== Installation and Dependencies =====
Line 27: Line 35:
 :!: **External requirements:** Office files (ODT, DOCX, PPTX, etc.) are supported natively. If you need image or PDF support, this plugin requires the following additional components that must be installed and integrated into your PHP environment separately:  :!: **External requirements:** Office files (ODT, DOCX, PPTX, etc.) are supported natively. If you need image or PDF support, this plugin requires the following additional components that must be installed and integrated into your PHP environment separately: 
  
-  * [[https://imagemagick.org|ImageMagick]] //(obligatory for both image and PDF support)// +  * Support for Office file thumbnails: 
-  * [[https://github.com/Imagick/imagick|Imagick]] (PHP extension for ImageMagick integration) //(obligatory for both image and PDF support)// +    * [[https://www.php.net/manual/de/book.zip.php|zip]] PHP extension 
-  * [[https://www.ghostscript.com/index.html|GhostScript]] //(obligatory for PDF support)//+    * libzip-dev (needed by zip) - your installation might already have this installed, or not. 
 +  * Support for PDF and image thumbnails: 
 +    * [[https://imagemagick.org|ImageMagick]] 
 +    * [[https://github.com/Imagick/imagick|Imagick]] (PHP extension for ImageMagick integration)  
 +    * [[https://www.ghostscript.com/index.html|GhostScript]] //(obligatory only for PDF support)//
  
 Hints: Hints:
-  * Installation on Windows were troublesome for me. The best description of how to install ImageMagick and Imagick was: [[https://tektriks.com/a-step-by-step-guide-on-how-to-install-imagemagick-in-windows/|A step by step guide on how to install ImageMagick in Windows]]. +  * ImageMagick installation might be troublesome. At least it was for me. My installation routine on Windows 10 x64 in detail: 
-  * Concerning the installation of GhostScript: despite all my efforts to wed GhostScript to ImageMagick via configuration failedI finally added GhostScripts `bin` folder to the System Environment PATH variable (which is ok) and then renamed `gswin32c.exe` to `gs.exe` (then made my donut suffer for it).+    * Install ''Ghostscript 9.56.1'' ([[https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9561/gs9561w64.exe|gs9561w64.exe]]). 
 +      * Ascertain that GS's ''bin'' folder was added to the System PATH variable. 
 +    * Install ''ImageMagick 7.1.0'' for x64 ([[https://windows.php.net/downloads/pecl/deps/ImageMagick-7.1.0-18-vc15-x64.zip|ImageMagick-7.1.0-18-vc15-x64.zip]]) by executing the following steps: 
 +      * Extract the ZIP's content to ''C:\Program Files\ImageMagick-7.1.0-18-vc15-x64''
 +      * Add ''C:\Program Files\ImageMagick-7.1.0-18-vc15-x64\bin'' to the System PATH variable manually. 
 +      * Open ''C:\Program Files\ImageMagick-7.1.0-18-vc15-x64\bin\policy.xml'' and either add the following line within ''<policymap>..</policymap>'': ''<policy domain="coder" rights="read|write" pattern="PDF" />''. If a similar line containing domain ''coder'' and pattern ''PDF'' already exists, change it accordingly. 
 +    * Install ''ImageMagick PHP extension'' ([[https://windows.php.net/downloads/pecl/releases/imagick/3.7.0/php_imagick-3.7.0-7.4-ts-vc15-x64.zip|php_imagick-3.7.0-7.4-ts-vc15-x64.zip]]) by executing the following steps: 
 +      * Extract all ''CORE_RL_*'', ''FILTER_*'' and ''IM_MOD_RL_*'' from the ZIP's content to ''C:\Program Files\ImageMagick-7.1.0-18-vc15-x64\bin''. Accept overwriting all files that may already be present there. Yes, that's the binaries folder of the ImageMagick installation. 
 +      * Extract ''php_imagick.dll'' to ''{PATH_TO}\php\ext''
 +      * Open ''{PATH_TO}\php\php.ini'' and add a line ''extension=imagick''. If using earlier versions of the software involved, you may have to try a combination like ''php_imagick'', ''imagick.dll'', ''php_imagick.dll''
 +    * Don't forget to restart the webserver. 
 +  * If you want or have to install another version, this might be a useful resource: [[https://mlocati.github.io/articles/php-windows-imagick.html|Install the ImageMagick PHP extension in Windows]] by [[https://github.com/mlocati|Michele Locati]]. It helps you identify the correct version of php_imagick in relation to your PHP installationFormerly, you also got a download link for the appropriate version of ImageMagick, but the version of this page visited today appears to not do that anymore. 
 +  * also wrote a Dockerfile (for an earlier installation / version constellation) that takes care of the modules to be installed, and makes config adjustments within ImageMagick (only works if the policy domain ''coder'' is predefined in ''policy.xml''it's not in the recent versions I came accross). It may help you nevertheless, in case you're using Docker:
  
-===== What's it for? =====+<code> 
 +FROM php:7-fpm
  
-This plugin will show thumbnail images for supported media files (ODT, DOCX, PPTX, PDF, JPG, etc.) within your wiki pages.+RUN apt-get update && apt-get install -y \ 
 +    imagemagick libmagickwand-dev \ 
 +    libzip-dev \ 
 +    libgs-dev \ 
 +    ghostscript --no-install-recommends \ 
 +    && pecl install imagick \ 
 +    && docker-php-ext-enable imagick \ 
 +    && pecl install zip \ 
 +    && docker-php-ext-enable zip
  
-In default settings, a click in the thumbnail will have your browser download the media file.+# Adjust ImageMagick security policy to allow PDF conversion 
 +ARG imagemagic_config=/etc/ImageMagick-*/policy.xml
  
-And an error message will be shown by default in case a referenced media file does not contain a thumbnail (office files) or is an unsupported file type (see dependencies on how you might work around that).+RUN if [ -f $imagemagic_config ] ; then sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read|write" pattern="PDF" \/>/g' $imagemagic_config ; else echo did not see file $imagemagic_config ; fi 
 +</code>
  
 ===== Syntax ===== ===== Syntax =====
Line 117: Line 152:
     * v0.91 (added image and PDF support)     * v0.91 (added image and PDF support)
       * config option `thumb_width` was dropped, so you might want to delete that entry from `conf/local.php` if you upgraded from v0.81 and had altered that value       * config option `thumb_width` was dropped, so you might want to delete that entry from `conf/local.php` if you upgraded from v0.81 and had altered that value
 +  * **2021-05-24**
 +    * v0.92 (Added checks for ImageMagick security policy issues)
  
 === Known Bugs and Issues === === Known Bugs and Issues ===
plugin/mediathumbnails.1617315823.txt.gz · Last modified: 2021-04-02 00:23 by thomas-schaefer-nh

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki