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-05-23 23:00] – Added dependency to zip and libzip-dev I uncovered today (for more recent PHP versions) 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 
Line 13: Line 13:
 tags       : images, media, mediamanager, thumbnail, odt, pdf 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 36: Line 44:
  
 Hints: Hints:
-  * Installation on Windows was troublesome for meThe best description of how to install ImageMagick and Imagick was: [[https://mlocati.github.io/articles/php-windows-imagick.html|Install the ImageMagick PHP extension in Windows]] by [[https://github.com/mlocati|Michele Locati]]. +  * ImageMagick installation might be troublesome. At least it was for me. My installation routine on Windows 10 x64 in detail: 
-    * It does not cover the installation process of ImageMagick, but the correct destribution archive is linked along with the matching PHP extension! +    * Install ''Ghostscript 9.56.1'' ([[https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9561/gs9561w64.exe|gs9561w64.exe]]). 
-    * In addition to the description on Michele'pageadded ImageMagick's bin folder to my systems' PATH variable and to a variable named MAGICK_HOME+      * Ascertain that GS's ''bin'' folder was added to the System PATH variable. 
-  * Concerning the installation of GhostScript: despite all my efforts, wedding GhostScript to ImageMagick via configuration failedI finally added GhostScript'`bin` folder to the System Environment PATH variable (which is ok) and then renamed `gswin32c.exe` to `gs.exe` (then I made my donut suffer for it).+    * 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 installation. Formerly, you also got a download link for the appropriate version of ImageMagick, but the version of this page I visited today appears to not do that anymore
 +  * I 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'not in the recent versions 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 123: 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.1621803638.txt.gz · Last modified: 2021-05-23 23:00 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