DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:lightbox

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
Last revisionBoth sides next revision
tips:lightbox [2015-06-05 19:31] goldseedtips:lightbox [2016-08-04 20:50] mirekn
Line 138: Line 138:
  
 {{http://i.imgur.com/BrkWojq.png}} {{http://i.imgur.com/BrkWojq.png}}
 +
 +
 +===== Internal image with slideshow grouping =====
 +
 +**Why?**
 +
 +  * To decide which image will have lightbox slideshow
 +  * Group together images into slideshow on one page as you like
 +
 +**How?**
 +
 +  * Apply new internal image hash parameter ''ss'' [:slide-show:]
 +  * Grouping is done by the value of ''ss'' parametter which is number and it is mandatory
 +
 +**E.g.**
 +
 +<code>
 +{{imagefile1.jpg#ss=1?640x480}} <- Slideshow group #1
 +{{imagefile2.jpg#ss=1?640x480}} <- Slideshow group #1
 +{{imagefile3.jpg#ss=2?640x480}} <- Slideshow group #2
 +{{imagefile4.jpg#ss=2?640x480}} <- Slideshow group #2
 +{{imagefile5.jpg?640x480}} <- Image without slideshow! :)
 +</code>
 +
 +:!: Notice that all hash parameters started by ''#'' sign are right after the filename and before the regular image link parameters, before the ''?'' symbol!
 +
 +**How to implement this adjustment?**
 +
 +  * Find file ''inc/parser/xhtml.php''
 +  * Find ''function internalmedia()'' 
 +  * Find this line:
 +
 +<file php>
 +$link['url'] = ml($src, array('id' => $ID, 'cache' => $cache, 'rev'=>$this->_getLastMediaRevisionAt($src)), ($linking == 'direct'));
 +</file>
 +
 +  * Insert 8 new lines before line above:
 +
 +<file php>
 +// activate lightbox slideshow group by #ss=1
 +if (!is_null(plugin_load('syntax', 'gallery'))) {
 +    $match = array();
 +    if (preg_match('/(?:^|(?<=&))ss=(\d+)(?:(?=&)|$)/', $hash, $match)) {
 +        $linking = 'direct';
 +        $link['rel'] = 'lightbox[gal-'.substr(md5($ID.'#ss='.$match[1]),4).']';
 +    }
 +}
 +</file>
 +
 +Patch for DokuWiki version 2015-08-10a:
 +<file diff>
 +--- dokuwiki-old/inc/parser/xhtml.php   2015-08-23 15:57:26.000000000 +0200
 ++++ dokuwiki/inc/parser/xhtml.php   2016-08-04 15:30:31.732748953 +0200
 +@@ -1117,6 +1117,14 @@
 +
 +         list($ext, $mime) = mimetype($src, false);
 +         if(substr($mime, 0, 5) == 'image' && $render) {
 ++            // activate lightbox slideshow group by #ss=1
 ++            if (!is_null(plugin_load('syntax', 'gallery'))) {
 ++                $match = array();
 ++                if (preg_match('/(?:^|(?<=&))ss=(\d+)(?:(?=&)|$)/', $hash, $match)) {
 ++                    $linking = 'direct';
 ++                    $link['rel'] = 'lightbox[gal-'.substr(md5($ID.'#ss='.$match[1]),4).']';
 ++                }
 ++            }
 +             $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache, 'rev'=>$this->_getLastMediaRevisionAt($src)), ($linking == 'direct'));
 +         } elseif(($mime == 'application/x-shockwave-flash' || media_supportedav($mime)) && $render) {
 +             // don't link movies
 +</file>
 +
tips/lightbox.txt · Last modified: 2016-08-05 03:59 by mirekn

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