flammy / imagebox

This dokuwiki plugin displays captions in a box drawn around an image.
https://www.dokuwiki.org/plugin:imagebox
GNU General Public License v2.0
5 stars 7 forks source link

Error: Call to undefined function mime_content_type() #126

Closed lu-p-us closed 1 year ago

lu-p-us commented 1 year ago

Hello,

today I updated the Dokuwiki imagebox plugin from version 2019-10-13 to the latest version 2023-08-13 via extension manager.

This results in a red error box saying "Error: Call to undefined function mime_content_type()", that the imagebox plugin might be the cause and that more details have been written to the error log.

grafik

The error log says, for example:

2023-08-14 08:37:17 F:\www\dowi\lib\plugins\imagebox\syntax.php(50) Error: Call to undefined function mime_content_type()
  #0 F:\www\dowi\inc\parser\handler.php(284): syntax_plugin_imagebox->handle(Array, 1, 1047, Object(Doku_Handler))
  #1 F:\www\dowi\inc\Parsing\Lexer\Lexer.php(270): Doku_Handler->plugin('[{{ a11:organig...', 1, 1047, 'imagebox')
  #2 F:\www\dowi\inc\Parsing\Lexer\Lexer.php(204): dokuwiki\Parsing\Lexer\Lexer->invokeHandler('[{{ a11:organig...', 1, 1047)
  #3 F:\www\dowi\inc\Parsing\Lexer\Lexer.php(147): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens('', '[{{ a11:organig...', 'plugin_imagebox', 1047, 1047)
  #4 F:\www\dowi\inc\Parsing\Parser.php(109): dokuwiki\Parsing\Lexer\Lexer->parse('Abteilung 11: A...')
  #5 F:\www\dowi\inc\parserutils.php(234): dokuwiki\Parsing\Parser->parse('\n====== Abteilu...')
  #6 F:\www\dowi\inc\parserutils.php(198): p_get_instructions('====== Abteilun...')
  #7 F:\www\dowi\inc\parserutils.php(525): p_cached_instructions('F:/www/dowi/dat...', false, 'a11:start')
  #8 F:\www\dowi\inc\parserutils.php(299): p_render_metadata('a11:start', Array)
  #9 F:\www\dowi\inc\common.php(266): p_get_metadata('a11:start')
  #10 F:\www\dowi\doku.php(97): pageinfo()
  #11 {main}

If I delete the line ('[{{ a11:organig...' from the page's source file, the same error is printed for the next occurrence, where the imagebox plugin is used. If I downgrade to version 2019-10-13, the error is gone.

I am running Dokuwiki release 2023-04-04a "Jack Jackrum".

flammy commented 1 year ago

@lu-p-us Is it possible to enable the php module fileinfo in your installation?

lu-p-us commented 1 year ago

I need to ask our server administrators. Am I right that the mime_content_type function is provided by the fileinfo module, which means: no module -> no function -> no imagebox?

https://github.com/flammy/imagebox/commit/f568f59b69235af9179772eb33a9b01f4350cf70 -> Line 50 and 59, right?

flammy commented 1 year ago

@lu-p-us I just released a version which checks if the function is present - this should help with your problem.

If you want support for vector graphics without a static width / height you have to enable fileinfo otherwise you can use the plugin as before.

lu-p-us commented 1 year ago

And the admin activated the fileinfo module on my side! Thanks for the quick fix.