GithubHelp home page GithubHelp logo

flammy / imagebox Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 7.0 138 KB

This dokuwiki plugin displays captions in a box drawn around an image.

Home Page: https://www.dokuwiki.org/plugin:imagebox

License: GNU General Public License v2.0

PHP 96.89% CSS 3.11%
dokuwiki dokuwiki-plugin php

imagebox's People

Contributors

alajovic avatar alexdraconian avatar flammy avatar mprins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

imagebox's Issues

Schmaler Bildschirm: Kein Zeilenumbruch oder Scrollbalken?

Dank für das Plugin!
Wenn ich aber meine Seite auf dem Telephon anschaue, dann fallen Bilder am rechten Rand einfach unter den Tisch. Man würde einen Seitenumbruch oder einen Scrollbalken erwarten - aber die Bilder sind einfach nicht sichtbar.

Mach' ich was falsch - oder gibt es hier noch Verbesserungspotential?

Dank und Grüße, Wolf

Make Image and Caption Linkable

I am encountering an issue where I want to use Imagebox to include a caption for images. But I also want the image and the caption to be a clickable hyperlink to another page in the wiki. I have been experimenting with different permutations of combining the Imagebox syntax with the native Dokuwiki syntax for making images clickable links and it just doesn't work.

Maybe I am missing something and this should work?

If not, is there any way to get a feature added to this plugin for this to be added to the native syntax of the plugin?

Can't make Image as links, I can only add it to the caption.

Is this a bug, or am I using the wrong code? I'm trying to make the image a link, but it won't let me, it keeps breaking and just thinks the rest is the link. It'll only allow me to make the caption the link, which isn't what I want. Does anyone have the right code or is this just not possible?

center aligned images always floating to the left

Using the following code, the image is always floating to the left when the image needs to be set in the middle of the page:
[{{ :getting_started:tutorials:haltest1.png?300 | //Control system of the test program// }}]
Edit: Using PHP 7.3 in case this information matters.

Update always showing up

I just updated to the latest version of imagebox but it still shows up as updateable.
Already tried to uninstall an re-install from scratch but that did not help.

Unbenannt

resolve_mediaid() is deprecated

From the Dokuwiki Error log Deprecated section:

2024-02-28 23:59:52resolve_mediaid() is deprecated. It was called from syntax_plugin_imagebox::handle() in /opt/webdata/dokuwiki/dokuwiki/lib/plugins/imagebox/syntax.php:41 dokuwiki\File\MediaResolver should be used instead!

Fails with SVG images

The plugin does not render SVG images and displays an error instead. The SVG image renders just fine if I just put it in curly braces.
Error message is: "Invalid link"

Otherwise, this is a very useful plugin. I'd advocate to include this into the default syntax.

---<)kaimartin(>---

Responsive image resizing

Moved issues from dokuwiki comment section to github:

It'd be nice if the use of imagebox didn't break responsive image functionality when using the default template in Detritus.

Version tested shows installed=Sat, 20 Dec 2014 11:46:58 +1100 in manager.dat

A crude hack allows this by changing:-

$renderer->doc.= '<div class="thumb2 t'.$match['align'].'" style="width:'.($match['w']?($match['w']+10).'px':'auto').'"><div class="thumbinner">';

to

$renderer->doc.= '<div class="thumb2 t'.$match['align'].'" style="width:100%"><div class="thumbinner">';

Note: only tested using plugin»imagebox»display_magnify = if necessary, and plugin imagebox center align = on

Breaks on PHP 7

Moved issues from dokuwiki comment section to github:

To fix it, edit line 90 of syntax.php to add braces to enforce proper evaluation order.

Error: Call to undefined function mime_content_type()

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".

set the alt text as well as the caption

Moved issues from dokuwiki comment section to github:

I would like the ability to set the alt text as well as the caption. Maybe syntax like

[{{:wiki:dokuwiki-128.png|Alt Text here|Caption goes here}}]

No support for HEIC

I added HEIC to the mime.local.conf file
heic image/heic

Once I added a HEIC image, I immediately get the following error message:

DIVISIONBYZEROERROR: DIVISION BY ZERO

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the imagebox plugin.

More info has been written to the DokuWiki error log.

And in the freshly created error log, I have the following entries:

2024-05-19 13:51:32	/mnt/web208/a1/44/512013944/htdocs/lib/plugins/imagebox/syntax.php(78)	E_WARNING: Trying to access array offset on value of type bool
  #0 /mnt/web208/a1/44/512013944/htdocs/lib/plugins/imagebox/syntax.php(78): dokuwiki\ErrorHandler::errorHandler()
  #1 /mnt/web208/a1/44/512013944/htdocs/inc/parser/handler.php(298): syntax_plugin_imagebox->handle()
  #2 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(269): Doku_Handler->plugin()
  #3 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(203): dokuwiki\Parsing\Lexer\Lexer->invokeHandler()
  #4 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(146): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens()
  #5 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Parser.php(113): dokuwiki\Parsing\Lexer\Lexer->parse()
  #6 /mnt/web208/a1/44/512013944/htdocs/inc/parserutils.php(234): dokuwiki\Parsing\Parser->parse()
  #7 /mnt/web208/a1/44/512013944/htdocs/inc/Ui/PageView.php(56): p_get_instructions()
  #8 /mnt/web208/a1/44/512013944/htdocs/inc/Action/Preview.php(32): dokuwiki\Ui\PageView->show()
  #9 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(120): dokuwiki\Action\Preview->tplContent()
  #10 [internal function]: tpl_content_core()
  #11 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(134): call_user_func_array()
  #12 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger()
  #13 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(102): dokuwiki\Extension\Event::createAndTrigger()
  #14 /mnt/web208/a1/44/512013944/htdocs/lib/tpl/varicolored/main.php(112): tpl_content()
  #15 /mnt/web208/a1/44/512013944/htdocs/inc/actions.php(30): include('...')
  #16 /mnt/web208/a1/44/512013944/htdocs/doku.php(131): act_dispatch()
  #17 {main}
2024-05-19 13:51:32	/mnt/web208/a1/44/512013944/htdocs/lib/plugins/imagebox/syntax.php(78)	E_WARNING: Trying to access array offset on value of type bool
  #0 /mnt/web208/a1/44/512013944/htdocs/lib/plugins/imagebox/syntax.php(78): dokuwiki\ErrorHandler::errorHandler()
  #1 /mnt/web208/a1/44/512013944/htdocs/inc/parser/handler.php(298): syntax_plugin_imagebox->handle()
  #2 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(269): Doku_Handler->plugin()
  #3 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(203): dokuwiki\Parsing\Lexer\Lexer->invokeHandler()
  #4 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(146): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens()
  #5 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Parser.php(113): dokuwiki\Parsing\Lexer\Lexer->parse()
  #6 /mnt/web208/a1/44/512013944/htdocs/inc/parserutils.php(234): dokuwiki\Parsing\Parser->parse()
  #7 /mnt/web208/a1/44/512013944/htdocs/inc/Ui/PageView.php(56): p_get_instructions()
  #8 /mnt/web208/a1/44/512013944/htdocs/inc/Action/Preview.php(32): dokuwiki\Ui\PageView->show()
  #9 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(120): dokuwiki\Action\Preview->tplContent()
  #10 [internal function]: tpl_content_core()
  #11 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(134): call_user_func_array()
  #12 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger()
  #13 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(102): dokuwiki\Extension\Event::createAndTrigger()
  #14 /mnt/web208/a1/44/512013944/htdocs/lib/tpl/varicolored/main.php(112): tpl_content()
  #15 /mnt/web208/a1/44/512013944/htdocs/inc/actions.php(30): include('...')
  #16 /mnt/web208/a1/44/512013944/htdocs/doku.php(131): act_dispatch()
  #17 {main}
2024-05-19 13:51:32	/mnt/web208/a1/44/512013944/htdocs/lib/plugins/imagebox/syntax.php(78)	DivisionByZeroError: Division by zero
  #0 /mnt/web208/a1/44/512013944/htdocs/inc/parser/handler.php(298): syntax_plugin_imagebox->handle()
  #1 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(269): Doku_Handler->plugin()
  #2 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(203): dokuwiki\Parsing\Lexer\Lexer->invokeHandler()
  #3 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Lexer/Lexer.php(146): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens()
  #4 /mnt/web208/a1/44/512013944/htdocs/inc/Parsing/Parser.php(113): dokuwiki\Parsing\Lexer\Lexer->parse()
  #5 /mnt/web208/a1/44/512013944/htdocs/inc/parserutils.php(234): dokuwiki\Parsing\Parser->parse()
  #6 /mnt/web208/a1/44/512013944/htdocs/inc/Ui/PageView.php(56): p_get_instructions()
  #7 /mnt/web208/a1/44/512013944/htdocs/inc/Action/Preview.php(32): dokuwiki\Ui\PageView->show()
  #8 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(120): dokuwiki\Action\Preview->tplContent()
  #9 [internal function]: tpl_content_core()
  #10 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(134): call_user_func_array()
  #11 /mnt/web208/a1/44/512013944/htdocs/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger()
  #12 /mnt/web208/a1/44/512013944/htdocs/inc/template.php(102): dokuwiki\Extension\Event::createAndTrigger()
  #13 /mnt/web208/a1/44/512013944/htdocs/lib/tpl/varicolored/main.php(112): tpl_content()
  #14 /mnt/web208/a1/44/512013944/htdocs/inc/actions.php(30): include('...')
  #15 /mnt/web208/a1/44/512013944/htdocs/doku.php(131): act_dispatch()
  #16 {main}

Large images not resized with PHP 8.x

After updating to the latest Dokuwiki release and at the same time to php 8.2 I have problems with images that are larger then the screen size. Without the [] around the image tag, the image resizes perfectly. But when I use the imagebox tags, the image is not resized but cropped. When I add a "?nolink&700" size attribute smaller than the body size, it works again good.

Instead of this
Screenshot 2023-08-19 at 13 14 42

it shows now

Screenshot 2023-08-19 at 13 15 02

Are you able to fix this?

Not working between two paragraphs

Moved issues from dokuwiki comment section to github:

This will place the second paragraph on the right side of the picture instead of after it (Google Chrome):

`Text text text

[{{...}}]

Text text text`

Failed to open stream: HTTP request failed!

Moved issues from dokuwiki comment section to github:

If PHP Gives you an error similar to the following:

Warning: getimagesize(http://www.mysite.us/sub-domain/wiki/_media/morse-code.png) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/xxxxxx/public_html/sub-domain/wiki/lib/plugins/imagebox/syntax.php on line 52

you can correct this issue by finding the following lines around line 49 in your ../lib/plugins/imagebox/syntax.php-file:

$match['source'] = str_replace(':','/',$match['src']); if($match['src']{0} == ':') $match['source'] = substr($match['source'],1); $gimgs = getImageSize(DOKU_URL.'_media/'.$match['source']);

and replace them with:

$match['source'] = str_replace('_','/',$match['src']); if($match['src']{0} == ':') $match['source'] = substr($match['source'],1); $gimgs = getImageSize(mediaFN(cleanID($match['source'])));

Does not cooperate with "\\" any more

Imageboxes done with this plugin used to accept line breaks done by double backslashes "\".
I used this on several occasions to position text below rather than being squeezed next to the image.
Apparently, this does not work any more. The double back slash is essentially ignored.

Is there a way to return to the previous behaviour?

Regards,
---<)kaimartin(>---

PS: Thank you for maintaining this very useful plugin!

Images and paragraphs

Boxed images do not respect paragraphs (i.e. if there is an empty line in between) as normal images do.

Case 1

{{image1.jpg}}
{{image2.jpg}}

produces <p><img><img></p>.

Case 2

{{image1.jpg}}

{{image2.jpg}}

produces <p><img></p><p><img></p>.

Boxing the images using [] gets the same result in both cases (<div>s next to each other, <p>s are not used at all). Fixing this issue will at least allow tweaking everything else in userscript.js and userstyle.css.

P.S. It would be perfect if the boxed images behave EXACTLY like normal images (with respect to paragraphs, margins, etc.).

Anyways, thanks for your work!

E_WARNING: Undefined array key 1/var/www/dokuwiki/lib/plugins/imagebox/syntax.php(28)

Constantly repeating message in DokuWiki log:

E_WARNING: Undefined array key 1/var/www/dokuwiki/lib/plugins/imagebox/syntax.php(28)
    #0 /var/www/dokuwiki/lib/plugins/imagebox/syntax.php(28): dokuwiki\ErrorHandler::errorHandler()
    #1 /var/www/dokuwiki/inc/parser/handler.php(284): syntax_plugin_imagebox->handle()
    #2 /var/www/dokuwiki/inc/Parsing/Lexer/Lexer.php(270): Doku_Handler->plugin()
    #3 /var/www/dokuwiki/inc/Parsing/Lexer/Lexer.php(204): dokuwiki\Parsing\Lexer\Lexer->invokeHandler()
    #4 /var/www/dokuwiki/inc/Parsing/Lexer/Lexer.php(147): dokuwiki\Parsing\Lexer\Lexer->dispatchTokens()
    #5 /var/www/dokuwiki/inc/Parsing/Parser.php(109): dokuwiki\Parsing\Lexer\Lexer->parse()
    #6 /var/www/dokuwiki/inc/parserutils.php(234): dokuwiki\Parsing\Parser->parse()
    #7 /var/www/dokuwiki/inc/parserutils.php(198): p_get_instructions()
    #8 /var/www/dokuwiki/lib/plugins/include/helper.php(269): p_cached_instructions()
    #9 /var/www/dokuwiki/lib/plugins/include/syntax/include.php(150): helper_plugin_include->_get_instructions()
    #10 /var/www/dokuwiki/inc/parser/renderer.php(119): syntax_plugin_include_include->render()
    #11 /var/www/dokuwiki/inc/parser/renderer.php(133): Doku_Renderer->plugin()
    #12 /var/www/dokuwiki/lib/plugins/include/syntax/include.php(157): Doku_Renderer->nest()
    #13 /var/www/dokuwiki/inc/parser/renderer.php(119): syntax_plugin_include_include->render()
    #14 /var/www/dokuwiki/inc/parserutils.php(540): Doku_Renderer->plugin()
    #15 /var/www/dokuwiki/inc/parserutils.php(299): p_render_metadata()
    #16 /var/www/dokuwiki/inc/common.php(266): p_get_metadata()
    #17 /var/www/dokuwiki/doku.php(97): pageinfo()
    #18 {main}

Dokuwiki Release 2023-04-04a "Jack Jackrum";
PHP 8.2;
Plugin imagebox version: 2019-10-13
Last updated: Sat, 29 Jul 2023 10:29:53 by Extension Manager.

Compatiblity with MathJax Plugin

I use DokuWiki as a Scientific Notebook and LaTeX is important to me. LaTeX is a tool for writing mathematics, often used by scientists, engineers, and others that use mathematics.

I'm finding that the inclusion of LaTeX inline notation breaks the rendering so that the image appears between two square brackets with no caption. I'm using the MathJaX plugin to get DokuWiki to render LaTeX. When I remove the LaTeX expressions, it renders fine.

As it's main parentheses, LaTeX uses the curly brackets, { }. For instance, 1/2 would be written as $\frac{1}{2}$. The issue appears to occur when the LaTeX expression includes a curly bracket.

[{{:playground:playground:pasted_2023_01_21_17_06_22.png| Consider the variable **U**.  This is DokuWiki bold is fine. }}]

[{{:playground:playground:pasted_2023_01_21_17_06_22.png| Consider the variable $U$.  This simple LaTeX is fine. }}]

[{{:playground:playground:pasted_2023_01_21_17_06_22.png| Consider the variable $\frac{U}{2}$.  This LaTeX fraction is not fine. }}]

Not working inside lists e.g. yalist

Moved issues from dokuwiki comment section to github:

The image box is not shown as inline picture, but only as floating box:

` -- item
.. [{{...}}]

  • ...
  • ...`

center aligned images not working

When you center an image like
[{{ :artwork:jpeg-37.jpeg?nolink |Dessin pour un calendrier Le Petit Robert, en 1987}}]

and the image is smaller than the with of the page, the image is aligned left with a correct box and text will flow on the right side.

With the config option: "plugin imagebox center align" enabled, the box is full with, text will not flow on the right side but the image is still aligned on the left, leaving blank space on the right.

Figure numbers based on heading number (if numbered headings installed)

Moved issues from dokuwiki comment section to github:

This is ok

[{{http://upload.wikimedia.org/wikipedia/commons/thumb/1/10/RCA-Studio-II.png/640px-RCA-Studio-II.png|Bild}}]

but not this

[{{http://upload.wikimedia.org/wikipedia/commons/thumb/1/10/RCA-Studio-II.png/640px-RCA-Studio-II.png|Bild Urheber:}}]

The column kills it with “Invalid Link”.

— chris

Center caption below image

Imagebox does a great job of centering the image but caption is always left justified. Please consider adding the option to center the caption under the image.

Thank you!

Cannot achieve side-by-side images with "No align"

I regularly want a set of images between two paragraphs, with the images sitting side-by-side. This is the default behaviour of Dokuwiki images (without imagebox), by simply putting multiple images with no blank line (paragraph break) between them. Eg:

{{:ns:image1.png?direct&200|caption1.}}
{{:ns:image1.png?direct&200|caption1.}}
{{:ns:image1.png?direct&200|caption1.}}

However, when I put [..] around these to get displayed captions, they shift to be one-image-per-line (undesired).

When I need one-image-per-line I can use centre align and it behaves as expected. Is there a way for me to get side-by-side images while using Imagebox?

I think it would be best if "no align" worked the same with imagebox as it does for default Dokuwiki images. This matches the typical user's expectations.

DokuWiki deprecated log

DokuWiki deprecated log:
require(syntax.php) is deprecated. It was called from require() in /var/www/dokuwiki/lib/plugins/imagebox/syntax.php:9 Autoloading should be used instead!

  • imagebox Plugin version: 2023-08-21;
  • DokuWiki version: 2023-04-04a "Jack Jackrum";
  • PHP 8.2;

Formatting difference with new version

Hello

A row of imageboxes that previously displayed side-by-side on the old version now display one underneath another in the new version.

For example,

[{{:a.png?300x200|caption a}}]

[{{:b.png?300x200|caption b}}]

[{{:c.png?300x200|caption c}}]\\

[{{:d.png?300x183|caption d}}]

[{{:e.png?300x200|caption e}}]

[{{:f.png?300x200|caption f}}]

...previously displayed 2 rows of 3 images, but now displays all 6 images one after another down the page. I can't figure out how to get back the old appearance.

No "references for" on media page

The info page (when clicking on media) and the Media Manager do not show references to boxed media ([{{...}}] syntax). When the box is removed ({{...}} syntax), the references are show correctly.

Using

  • imagebox 2016-11-22
  • dokuwiki 2018-04-22b "Greebo"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.