DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy

devel:event:media_resize

Table of Contents

MEDIA_RESIZE

Description:
handles media resizing or cropping
DefaultAction:
use configured image manipulation engine (GD or IM) to resize or crop media as needed
Preventable:
yes
Added:
2020-06-30

This event can be used to alter the resizing or cropping process in lib/exe/fetch.php. It can be used to prevent the native resizing algorithm in whatever case is required, for example, if there is a need to use a specific algorithm not available in DokuWiki, or disable resizing for certain file extensions. This is processed before the MEDIA_SENDFILE but after FETCH_MEDIA_STATUS and offers a BEFORE and an AFTER processing.

The native resizing algorithm can be prevented by calling $event->preventDefault() in the BEFORE process.

If manipulating the image, the processed image's URL should be set as $data['file'] in the AFTER process.

Passed Data

  • $data['media'] – The id for the called file
  • $data['file'] – The filename of the file about to be delivered, can be modified by your plugin
  • $data['mime'] – The Mime-Type of the file, can be modified by your plugin
  • $data['download'] – Whether the file is to be downloaded or displayed inline
  • $data['cache'] – The wanted cache behavior (-1 = cache forever, 0 = never cache, >0 cache time in seconds), can be modified by your plugin
  • $data['ext'] – Extension of the file
  • $data['width'] – Images only: the wanted width as specified in the request
  • $data['height'] – Images only: the wanted height as specified in the request
  • $data['status'] – The current status code of the request
  • $data['statusmessage'] – The status message corresponding to the status above

See also

devel/event/media_resize.txt · Last modified: 2020-09-28 18:40 by samyelman