DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:imagebox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:imagebox [2016-11-04 15:42] – moved bug to github flamplugin:imagebox [2024-01-14 18:43] (current) Aleksandr
Line 1: Line 1:
-====== imagebox Plugin ======+====== Imagebox Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Syntax for display an image with a caption, like Wikipedia.org +description : Syntax for display an image with a caption, like Wikipedia.org 
-author     : Lukas Rademacher, FFTiger & myst6re +author      : Lukas Rademacher, FFTiger & myst6re 
-email      : lukas@rademacher.ac +email       : lukas@rademacher.ac 
-type       : syntax +type        : syntax 
-lastupdate : 2016-11-04 +lastupdate  2023-08-21 
-compatible : Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, 2014-09-29 "Hrun", Detritus,Elenor of Tsort +compatible  2023-04-04, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, Igor 
-depends    :  +depends     :  
-conflicts  :  +conflicts   :  
-similar    : imagereference +similar     : imagereference, latexcaption 
-tags       : media, images, mediawiki, caption +tags        : media, images, mediawiki, caption
- +
-downloadurl: https://github.com/flammy/imagebox/tarball/master +
-bugtracker : https://github.com/flammy/imagebox/issues +
-sourcerepo : https://github.com/flammy/imagebox/ +
  
 +downloadurl : https://github.com/flammy/imagebox/tarball/master
 +bugtracker  : https://github.com/flammy/imagebox/issues
 +sourcerepo  : https://github.com/flammy/imagebox/
 +donationurl : 
 + 
 +screenshot_img : 
 ---- ----
  
-===== Installation =====+===== Description =====
  
-  - Installing the plugin+This plugin displays an image with caption, like Wikipedia.org
-    * Automatic: +
-      * install the plugin via the [[plugin:plugin|Plugin Manager]] at the admin page under "Manage Plugins". Then enter the URL for the plugin under ''Download and install new plugin'' +
-    * Manual: +
-      * you can extract the archive into the ''lib/plugins'' directory manually +
-  - Update the ''Configuration Settings'' under the admin page.+
  
-===== Preview ===== 
  
-{{http://wikisquare.ffdream.com/public/imagebox/imagebox-i3.png |Example img}}+{{https://wikisquare.ffdream.com/public/imagebox/imagebox-i3.png?recache |Example image 3}}
  
-{{http://wikisquare.ffdream.com/public/imagebox/imagebox-i2.png |Example img}}+{{https://wikisquare.ffdream.com/public/imagebox/imagebox-i2.png?recache |Example image 2}}
  
-{{http://wikisquare.ffdream.com/public/imagebox/imagebox-i1.png |Example img}}+{{https://wikisquare.ffdream.com/public/imagebox/imagebox-i1.png?recache |Example image 1}}
  
 ===== Usage ===== ===== Usage =====
  
-Just add ''[ ]'' around the image tag.+Just add ''%%[ ]%%'' around the image tag.
  
   [{{ImagePath|Caption}}]   [{{ImagePath|Caption}}]
- +
 The caption can be formatted. The caption can be formatted.
  
-Make sure, to empty the cache of the browser(In FirefoxPress [shift] while clicking the reload button)+===== Configuration ===== 
 + 
 +The plugin can be configured within the admin panel 
 + 
 +==== display magnify ==== 
 + 
 +Display the click-enlarge icon: 
 + 
 +  * If necessary 
 +  * Always 
 +  * Never 
 + 
 +==== center align ==== 
 + 
 +==== default caption style ==== 
 + 
 +Default style for the image caption: 
 + 
 +  * Normal 
 +  * Italic 
 +  * Bold 
 ===== History ===== ===== History =====
  
 +  * 2023/08/13 : svg support, move plugin support, fix: alignmend-issues, fix: warning
 +  * 2019/07/31 : fixed height syntax
 +  * 2019/07/02 : New languages, Float-fixes
 +  * 2016/11/22 : Fixed responsive image size,fixed centered imageboxes, fixed overwidth captions
   * 2016/11/04 : PHP7 compatibility   * 2016/11/04 : PHP7 compatibility
   * 2016/11/04 : Forked to github   * 2016/11/04 : Forked to github
Line 59: Line 79:
   * 2008/11/18 : Don't resize images to their original size. (Better compression)   * 2008/11/18 : Don't resize images to their original size. (Better compression)
   * 2008/11/07 : imagebox use more DokuWiki functions (+ fix bad media URL)   * 2008/11/07 : imagebox use more DokuWiki functions (+ fix bad media URL)
-  * 2008/10/07 : new version ! (Clean "<div class="thumbinner">", add a better EntryPatern.) +  * 2008/10/07 : new version ! (Clean "%%<div class="thumbinner">%%", add a better EntryPatern.)
- +
-====== Discussion ====== +
- +
-Brilliant! Kudos to FFTiger & myst6re. +
- --- //Kudos 2008/??/?? ??:??// +
- +
-> Thanks +
-> --- //[[myst6re@laposte.net|myst6re]] 2008/10/03 16:22// +
- +
-Awesome plugin, but I have one feature request.  I would like the ability to set the alt text as well as the caption.  +
-Maybe syntax like <code>[{{:wiki:dokuwiki-128.png|Alt Text here|Caption goes here}}]</code> +
- +
-Thanks, +
--- //Jonathan// +
- +
-Hacked in support for the odt plugin. I've modified the code from syntax.php above so you'll have to manually copy and paste the code. Changes (added temporary private variable, modified render() function to include the 'odt' mode) (update update: sorry messed up the paragraphs, fixed now), George +
- +
-It's very nice, but does not work in combination with the odt plugin. images within a box are ignored when exporting. +
--- [[mc.prins@gmail.com|Mark]] +
- +
-I love the plugin and use it all over my wiki. I'm starting to use the [[http://danjer.doudouke.org/tech/dokutexit|DokuTexit]] plugin to easily generate PDFs from my articles. Unfortunately, imagebox doesn't appear to be compatible. It would be great if the imagebox rendered as a plain image does in DokuTexit (a float with a caption). The Dokutexit people have a stub for adding dokutexit support to other syntax plugins. I'd love to help, but don't know PHP. Any help would be appreciated! +
--- [[apascall@engineering.ucsb.edu|Andy]] +
- +
-===== Bugs ===== +
- +
-spinkao: When I use your plugin, I only get the picture in a double frame, but no text is displayed. What could be wrong, please? The command I use looks like this: +
- +
-%%[{{figure.jpg|This is my caption  }}]%% +
- +
-> I have the same issue with the December 2009 version: I have a JavaScript error, maybe it is related to this ?   +
-> I had to rollback to the older version :-( +
- +
-> I have (hope) correct this bug: in the sintax.php, change this line: +
-> <code>$renderer->doc.= '<div class="thumbcaption" style="display:'.($match['title']==''?'none':'block').'">';</code> +
-> with this +
-> <code>$renderer->doc.= '<div class="thumbcaption" style="display:block">';</code> +
-+
->— Luigi 2009/12/18 +
- +
-==== Failed to open stream: HTTP request failed! ==== +
- +
-If PHP Gives you an error similar to the following: +
-<code> +
-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 +
-</code> +
- +
-you can correct this issue by finding the following lines around line 49 in your ''../lib/plugins/imagebox/syntax.php''-file: +
-<code php> +
-$match['source'] = str_replace(':','/',$match['src']); +
-if($match['src']{0} == ':'+
-$match['source'] = substr($match['source'],1); +
-$gimgs = getImageSize(DOKU_URL.'_media/'.$match['source']); +
-</code> +
- +
-and replace them with: +
-<code php> +
-$match['source'] = str_replace('_','/',$match['src']); +
-if($match['src']{0} == ':'+
-$match['source'] = substr($match['source'],1); +
-$gimgs = getImageSize(mediaFN(cleanID($match['source'])));  +
-</code> +
- +
- --- //Anonymous 2008/??/?? ??:??// +
- +
-> Fixed and improved ! Thank you very much for your help. 8-) +
-> --- //[[myst6re@laposte.net|myst6re]] 2008/11/07 23:05// +
- +
->> Great plugin, thanks! I still get the above mentioned error using the 11/18 revision when my images are in a namespace other than root. The problem seems to be in the line: +
->>  +
->> <code>$gimgs = getImageSize(mediaFN($match['src']));</code> +
->> as the mediaFN function only returns the media path to the root namespace.  It seems like a simple fix but I'm not familiar with DokuWiki enough to know the correct function to tack on the extra namespace directory. I'm currently using a workaround where I type the entire namespace path into the image filename field. +
->>  +
->> --- //Anonymous 2008/??/?? ??:??// +
- +
-==== Does not work correctly? ==== +
- +
-This plugin does not work correctly. As instructed, I used the plugin manager to install this. Installation was successful, but using the code +
-  [{{Image:Image.png|Title}}] +
-results in the following (with a single box around both text and image, but without box around the text and without the maximize icon on the right of the text): +
- +
-{{wiki:dokuwiki-128.png}} +
- +
-Title +
- +
- --- //Anonymous 2008/??/?? ??:??// +
- +
-> Firstly, have you tried Shift+Refresh? And secondly, the maximize icon is not showed when the image is not resized, like Wikipedia. +
->  +
-> --- //FFTiger 2008/12/29 ??:??// +
- +
->> I can confirm that the above described functionality is working correctly with the ''2008/12/29''-release. I had to search for the icon too, so thanks for the explanation... :-) +
->>  +
->> --- //[[mischa_the_evil@hotmail.com|Mischa The Evil]] 2008/12/29 18:05// +
- +
----- +
- +
-Version 2009-04-23 +
-Bug: alignment to center does not work. +
-Fix: in file style.css line 19 change +
-<code> +
-div.tcenter{ +
-to +
-div.ttcenter{ +
-</code> +
- --- //[[admin@vedeme.cz|MarHaj]] 23:02 26.05.2009// +
- +
----- +
- +
-For me, the alignment to center didn't work, even with the Marhaj's solution. I found a way to repair it:\\ +
-In the syntax.php, line 35, I replaced: +
-<code> $match=Doku_Handler_Parse_Media(substr($match,3));</code> +
-by: +
-<code> $match=Doku_Handler_Parse_Media(substr($match,3,-1));</code> +
- +
-With the original version, the script takes the syntax "[{{.........|" in all case, and verify if the last character is the mark of alignment (space), but it's ever a "|".\\ +
-In my modification, I delete the "|"+
- +
-To center a picture, you have to put a space after "[{{" and one other before the "|", that's all! +
- +
- --- Yohann - 10:05 - 06-29-2009 +
- +
-==== Does not work properly when picture is last item of paragraph ==== +
- +
-When you have a picture in an imagebox at the last line of a paragraph the edit button does not show up below the imagebox but at the top line of the imagebox. (tested with DokuWiki Release 2009-02-14 and default template) +
---- //[[Ralf]] 2009/02/23 14:14// +
- +
-> Add this code in style.css: +
-> <code css>div.dokuwiki div.secedit input.button { +
-clear:both !important; +
-}</code> +
-> --- //myst6re 2009/02/27 18:35// +
- +
-==== Does not display box ==== +
- +
-I have installed and refreshed the page and if I use the syntax you specified: +
-<code>[{{news:imagehere.jpg|caption text}}]</code> it does not show a box at all, but rather it shows it like below: +
- +
-{{wiki:dokuwiki-128.png|}} +
- +
-Title +
- +
- +
-> Try HARD-refresh (Shift + refresh)  +
->-myst6re +
->>Still doesn't work! -ivan +
- +
-==== relative folder ==== +
- +
-__Limitation__: in version available at 6/12/2009 only absolute path for the media-folder are supported. +
- +
-If **$match['src']** would be resolved with **resolve_mediaid()** even inputs like %%[{{car.gif|abc}}]%% (with car.gif is in a parallel media folder) could be displayed. +
- +
-> Fixed :-) +
-> --- //myst6re 2009/12/06 19:17// +
- +
-==== Does not display caption ==== +
- +
-%%$match['title']%% is always empty, so the caption gets display:none;. I’ve changed the Parser in the handle function to workaround this: +
-  $match=Doku_Handler_Parse_Media(substr($match.'|',3)); +
-   +
-:  Yes, this plugin seems to be broken (version 25.12.09) - changing the handle function has to be done in the universal DokuWiki code, not just the plugin folder - so this might brake other functions. - Could someone please fix this bug? (Bernd, 20. Jan 2010) +
- +
-> I fixed my mistake, sorry +
-> --- //myst6re 2009/21/01 17:15// +
- +
->> Thanks, comrade, this was fast, and it works - you are hereby awarded the [[wp>Order of Glory]]! (Bernd 23.Jan 2010) +
- +
-====Does not work with image links?==== +
- +
-It seems the plugin does not work with linked images.  +
-    [[www.somelink.com|{{www.somelink.com/imageone.jpg}}]]] +
-But thanks anyway - great idea +
- +
-=== It works === +
- +
-You weren't using the right syntax. Here's how it works: <code>[{{http://exampleimage.jpg|Your caption}}]</code> +
- +
-==== Not working inside lists e.g. yalist ==== +
- +
-The image box is not shown as inline picture, but only as floating box: +
-<code> +
-  -- item +
-  .. [{{...}}] +
-  - ... +
-  - ... +
-</code> +
- +
-==== Not working between two paragraphs ==== +
- +
-This will place the second paragraph on the right side of the picture instead of after it (Google Chrome): +
- +
-<code> +
-Text text text +
- +
- +
-[{{...}}] +
- +
- +
-Text text text +
-</code> +
- +
-> Similar problem. If i wrote: +
-><code> +
- [{{...|figure1}}]Paragraph 1 right to figure 1 +
-  +
- [{{...|figure2}}]Paragraph 2 right to figure 2 +
-</code>and if figure 1 is quite high, it show: +
-><code> +
-  figure1 paragraph1 +
-  figure1 figure2 paragraph2 +
-</code> instead of  +
-><code> +
-  figure1 paragraph1 +
-   +
-  figure2 paragraph2 +
-</code> +
-> (ribez 2011/04/23) +
-> 2015/10/16 - problem "Not working between two paragraphs" not fixed yet =(   +
- +
-=== "Invalid Link" if used with img url === +
- +
-If used with a img url it displays bos and caption but "Invalid Link" instead of the img. +
- +
-[{{http://source.com/file.jpg|caption}}]+
  
-===== Feature Requests =====+===== Discussion & Troubleshooting =====
  
 +If you encounter problems make sure, to empty the cache of the browser. (In Firefox: Press [shift] while clicking the reload button)
  
 +Please use the issue tracker for feature-requests and bug-reports.
  
-==== Breaks on PHP 7 ==== 
-To fix it, edit line 90 of syntax.php to add braces to enforce proper evaluation order: 
-<code php syntax.php:86:94> 
-         switch($state){ 
-            case DOKU_LEXER_ENTER: 
-               $renderer->doc.= '<div class="thumb2 t'.$match['align'].'" style="width:'.($match['w']?($match['w']+10).'px':'auto').'"><div class="thumbinner">'; 
-               if($match['exist']) 
-                  // Old, Broken // $renderer->$match['type']($match['src'],$match['title'],'box2',$match['width'],$match['height'],$match['cache'],$match['linking']); 
-                  $renderer->{$match['type']}($match['src'],$match['title'],'box2',$match['width'],$match['height'],$match['cache'],$match['linking']); 
-               else 
-                  $renderer->doc.= 'Invalid Link'; 
-               $renderer->doc.= '<div class="thumbcaption">'; 
-               if($match['detail']) { 
-</code> 
plugin/imagebox.1478270577.txt.gz · Last modified: 2016-11-04 15:42 by flam

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