DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dpicorrect

dpicorrect Plugin

Compatible with DokuWiki

2009-12-25c

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
2010-09-16
Provides
Action

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

Download and install the plugin using the Plugin Manager using the URL given above (the little puzzle block icon under the description). Refer to Plugins on how to install plugins manually.

To install the plugin manually, download the source to your plugin folder, lib/plugins, and extract its contents. That will create a new plugin folder, lib/plugins/dpicorrect, containing a single file, action.php – The plugin is now installed.

Prerequisites

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.

Bugs

None known.

Todo

Nothing planned.

plugin/dpicorrect.txt · Last modified: 2016-01-24 19:30 by Aleksandr