xref: /plugin/pagesicon/DOKU_EN.md (revision 74a9e7636f2e172c4b5990b529a0ab322717c972)
1*74a9e763SLORTET====== Pagesicon Plugin ======
2*74a9e763SLORTET
3*74a9e763SLORTET---- plugin ----
4*74a9e763SLORTETdescription: Manage and expose page/media icons
5*74a9e763SLORTETauthor     : Lortet
6*74a9e763SLORTETemail      : valentin@lortet.io
7*74a9e763SLORTETtype       : Action, Helper
8*74a9e763SLORTETlastupdate : 2026-03-09
9*74a9e763SLORTETcompatible : Librarian
10*74a9e763SLORTETdepends    :
11*74a9e763SLORTETconflicts  :
12*74a9e763SLORTETsimilar    :
13*74a9e763SLORTETtags       : Media, UI, Navigation, Helper, Icons
14*74a9e763SLORTET
15*74a9e763SLORTETdownloadurl: https://github.com/Lortet/dokuwiki-plugin-pagesicon/zipball/master
16*74a9e763SLORTETbugtracker : https://github.com/Lortet/dokuwiki-plugin-pagesicon/issues
17*74a9e763SLORTETsourcerepo : https://github.com/Lortet/dokuwiki-plugin-pagesicon/
18*74a9e763SLORTETdonationurl:
19*74a9e763SLORTETscreenshot_img :
20*74a9e763SLORTET----
21*74a9e763SLORTET
22*74a9e763SLORTET===== Installation =====
23*74a9e763SLORTET
24*74a9e763SLORTETInstall the plugin from the [[plugin:extension|Extension Manager]] using the source download URL above.
25*74a9e763SLORTET
26*74a9e763SLORTET===== Description =====
27*74a9e763SLORTET
28*74a9e763SLORTETThe **pagesicon** plugin allows you to:
29*74a9e763SLORTET  * display an icon at the top of the page;
30*74a9e763SLORTET    * {{https://i.ibb.co/TBz1yVHB/Screenshot-2026-03-06-at-20-25-47-Welcome-to-your-new-Doku-Wiki-Wiki-BSPP.png?250}}
31*74a9e763SLORTET    * {{https://i.ibb.co/XZd613sL/Screenshot-2026-03-06-at-20-25-39-Formatting-Syntax-Wiki-BSPP.png?250}}
32*74a9e763SLORTET  * use the page icon as favicon (browser tab icon);
33*74a9e763SLORTET  * manage the icon from the page action ''?do=pagesicon'';
34*74a9e763SLORTET    * {{https://i.ibb.co/1JBtfvH9/Screenshot-2026-03-06-at-20-26-12-Welcome-to-your-new-Doku-Wiki-Wiki-BSPP.png?250}}
35*74a9e763SLORTET  * expose a helper API for other plugins (e.g. catmenu, visualindex).
36*74a9e763SLORTET    * {{https://i.ibb.co/Mkv7RY8K/Screenshot-2026-03-06-at-20-26-00-Welcome-to-your-new-Doku-Wiki-Wiki-BSPP.png?250}}
37*74a9e763SLORTET
38*74a9e763SLORTET===== Settings =====
39*74a9e763SLORTET
40*74a9e763SLORTET^ Name ^ Description ^ Default value ^
41*74a9e763SLORTET| icon_name | Candidate names for the ''big'' icon (separated by '';''). Supports ''~pagename~''. | ''~pagename~;icon_thumbnail;icon'' |
42*74a9e763SLORTET| icon_thumbnail_name | Candidate names for the ''small'' icon (separated by '';''). Supports ''~pagename~''. | ''~pagename~;icon'' |
43*74a9e763SLORTET| default_image | Default image (mediaID), used when ''withDefault=true'' on URL methods. | '''' |
44*74a9e763SLORTET| icon_size | Size of the icon displayed at the top of the page (px). | ''55'' |
45*74a9e763SLORTET| extensions | Allowed image extensions (separated by '';''). | ''svg;png;jpg;jpeg'' |
46*74a9e763SLORTET| show_on_top | Show icon at the top of the page. | ''true'' |
47*74a9e763SLORTET| show_as_favicon | Use the icon as page favicon. | ''true'' |
48*74a9e763SLORTET
49*74a9e763SLORTET===== Usage =====
50*74a9e763SLORTET
51*74a9e763SLORTETFrom a page, use the **Manage icon** action, then:
52*74a9e763SLORTET  * upload a ''big'' or ''small'' icon;
53*74a9e763SLORTET  * delete the current icon.
54*74a9e763SLORTET
55*74a9e763SLORTET===== Helper API =====
56*74a9e763SLORTET
57*74a9e763SLORTETLoad helper:
58*74a9e763SLORTET''$pagesicon = plugin_load('helper', 'pagesicon');''
59*74a9e763SLORTET
60*74a9e763SLORTET^ Method ^ Description ^
61*74a9e763SLORTET| ''getPageIconId($namespace, $pageID, $size = "bigorsmall")'' | Returns a mediaID (or ''false''). |
62*74a9e763SLORTET| ''getMediaIconId($mediaID, $size = "bigorsmall")'' | Returns the media icon mediaID (or ''false''). |
63*74a9e763SLORTET| ''getPageIconUrl($namespace, $pageID, $size = "bigorsmall", $params = ['width' => 55], &$mtime = null, $withDefault = false)'' | Returns a versioned icon URL (''pi_ts=<filemtime>'') or ''false''. |
64*74a9e763SLORTET| ''getMediaIconUrl($mediaID, $size = "bigorsmall", $params = ['width' => 55], &$mtime = null, $withDefault = false)'' | Returns a versioned media icon URL (''pi_ts=<filemtime>'') or ''false''. |
65*74a9e763SLORTET| ''getDefaultIconUrl($params = ['width' => 55], &$mtime = null)'' | Returns the configured default image URL, or bundled ''default_image.png''. |
66*74a9e763SLORTET| ''getUploadIconPage($targetPage = "")'' | Returns the icon management URL (or ''null'' if unauthorized). |
67*74a9e763SLORTET| ''getUploadMediaIconPage($mediaID = "")'' | Returns the icon management URL for a media. |
68*74a9e763SLORTET| ''notifyIconUpdated($targetPage, $action = "update", $mediaID = "")'' | Triggers the cache invalidation event. |
69*74a9e763SLORTET
70*74a9e763SLORTET===== Event =====
71*74a9e763SLORTET
72*74a9e763SLORTETOn upload/delete, the plugin emits:
73*74a9e763SLORTET  * ''PLUGIN_PAGESICON_UPDATED''
74*74a9e763SLORTET    * to allow cache invalidation in consumer plugins.
75*74a9e763SLORTET
76*74a9e763SLORTETPayload:
77*74a9e763SLORTET  * ''target_page''
78*74a9e763SLORTET  * ''action''
79*74a9e763SLORTET  * ''media_id''
80*74a9e763SLORTET
81*74a9e763SLORTET===== Signature compatibility =====
82*74a9e763SLORTET
83*74a9e763SLORTETHistorical signatures (before ''09-03-2025''):
84*74a9e763SLORTET  * ''getPageImage($namespace, $pageID, $size = "bigorsmall")''
85*74a9e763SLORTET  * ''getMediaImage($mediaID, $size = "bigorsmall")''
86*74a9e763SLORTET  * ''getImageIcon($namespace, $pageID, $size = "bigorsmall", $params = ['width' => 55], &$mtime = null)''
87*74a9e763SLORTET  * ''getMediaIcon($mediaID, $size = "bigorsmall", $params = ['width' => 55], &$mtime = null)''
88*74a9e763SLORTET
89*74a9e763SLORTETCompatibility is preserved through legacy aliases:
90*74a9e763SLORTET  * ''getPageImage(...)'' -> ''getPageIconId(...)'' (legacy ''$withDefault'' argument is ignored)
91*74a9e763SLORTET  * ''getMediaImage(...)'' -> ''getMediaIconId(...)'' (legacy ''$withDefault'' argument is ignored)
92*74a9e763SLORTET  * ''getImageIcon(...)'' -> ''getPageIconUrl(...)''
93*74a9e763SLORTET  * ''getMediaIcon(...)'' -> ''getMediaIconUrl(...)''
94*74a9e763SLORTET  * ''getDefaultImageIcon(...)'' -> ''getDefaultIconUrl(...)''
95