It's better when it's simple

User Tools

Site Tools


dpicorrect Plugin

Compatible with DokuWiki


plugin Corrects on-page image size based on their resolution (dpi), giving them a width and height attribute based on their print dimensions. I.e., a 240dpi 960x720 image will be sized to 4"x3".

Last updated on

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with dpi, images

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.


This plugin will only work on servers that have a PHP installation that comes with GD. You can check whether your server satisfies this criterium by making a php file with as sole content:

<?php phpinfo(); ?>

You can then upload this to your server, and visiting it using your web browser. This will tell you your PHP configuration: if “GD” is not mentioned, this plugin will not work for you, and it'll trow errors about the fact that ImageCreateFromJPEG or ImageCreateFromPNG don't exist.

Syntax and Usage

This plugin as no configuration. If enabled, it will set explicit width and height attributes for JPG and PNG images, with their dimensions computed based on their resolution. GIF is an exclusively on-screen format and has no resolution, so these are left alone.

If a JPG or PNG image has a dpi value of 240, and measures 960 pixels by 720 pixels, it will be given a rendering width/height of 4“ by 3”.

When does it not do anything?

This plugin will leave GIF images untouched, as well as JPG or PNG images that are either missing x/y dimension values, have values with an unspecified unit, or have values that indicate a vertical or horizontal resolution of “0 pixels per inch”.

Additionally, it won't do anything if the image link points to an image that doesn't actually exist.


None known.


Nothing planned.

plugin/dpicorrect.txt · Last modified: 2023-10-30 23:50 by Klap-in

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