DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:snap

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
plugin:snap [2010-03-03 11:37] 145.242.11.3plugin:snap [2010-03-03 20:06] 74.93.99.97
Line 13: Line 13:
 tags       : media, images, links tags       : media, images, links
  
-^downloadurl: http://emauvaisfr.free.fr/dokuwiki/snap.tar.gz+downloadurl: http://emauvaisfr.free.fr/dokuwiki/snap.tar.gz
 bugtracker : bugtracker :
 sourcerepo : sourcerepo :
Line 33: Line 33:
     * This may not be possible if your DokuWiki is hosted...     * This may not be possible if your DokuWiki is hosted...
  
-  * Softwares needed to do the snapshot:+  * Software needed to do the snapshot:
     * ''html2image'': the tool that does the URL snapshot.     * ''html2image'': the tool that does the URL snapshot.
       * See http://www.guangmingsoft.net/htmlsnapshot/html2image.htm       * See http://www.guangmingsoft.net/htmlsnapshot/html2image.htm
Line 62: Line 62:
  
   * Why is it so complicated?!   * Why is it so complicated?!
-    * Because when you try to call ''html2image'' directly from a php page, you get a ''pagination fault'' error.+    * Because when you try to call ''html2image'' directly from a PHP page, you get a ''pagination fault'' error.
  
-  * After the snapshot, the snap image is available as a ''.jpg'' file on the HD (into ''./data/snap'' for example). +  * After the snapshot, the snap image is available as a ''.jpg'' file on the hard drive (into ''./data/snap'' for example). 
-    * The name of this file keeps track of the url that was "snaped" and the snap size (ex: ''start_300x200.jpg'')+    * The name of this file keeps track of the URL that was "snapped" and the snap size (ex: ''start_300x200.jpg'')
     * A snap cache mechanism is used to avoid generating a snapshot over and over. If the snap is found on the drive, having the same dimensions and not too old (regarding ''$conf['cachetime']''), it is not generated again (unless you ask to force snapshot without using the cache (see [[#syntax|below]]))     * A snap cache mechanism is used to avoid generating a snapshot over and over. If the snap is found on the drive, having the same dimensions and not too old (regarding ''$conf['cachetime']''), it is not generated again (unless you ask to force snapshot without using the cache (see [[#syntax|below]]))
  
Line 71: Line 71:
 ===== Important ===== ===== Important =====
   * Be aware that people can read snap of pages they may not have right to access (this is due to snap caching). However, the snap is normally small enough to prevent a comfortable reading ;-)   * Be aware that people can read snap of pages they may not have right to access (this is due to snap caching). However, the snap is normally small enough to prevent a comfortable reading ;-)
-  * If your DokuWiki is not open for reading to everyone (use of authentication), you must configure the helper to add login parameters to the url to snap. See the ''helper.php'' file to do this right. +  * If your DokuWiki is not open for reading to everyone (use of authentication), you must configure the helper to add login parameters to the URL to snap. See the ''helper.php'' file to do this right. 
-    * It is recommended to use [[:tips:phashlogin|this tip]] to avoid clear password into the urls, but an password hash instead.+    * It is recommended to use [[:tips:phashlogin|this tip]] to avoid clear password into the URLs, but an password hash instead.
   * By now, the snap server and the DokuWiki server have to be on the same computer.   * By now, the snap server and the DokuWiki server have to be on the same computer.
     * A next version will try to make it possible to have separate computers.     * A next version will try to make it possible to have separate computers.
Line 79: Line 79:
  
 ===== Installation ===== ===== Installation =====
-  * Given examples are valid for a linux Debian v4.0 distribution.+  * Given examples are valid for a Linux Debian v4.0 distribution.
  
 ==== html2image ==== ==== html2image ====
Line 156: Line 156:
   * The getSnap() function is used to do the snapshot of a site.   * The getSnap() function is used to do the snapshot of a site.
     * Parameters:     * Parameters:
-      * Url to snap or DokuWiki page ID (required)+      * URL to snap or DokuWiki page ID (required)
       * Snap width (optional)       * Snap width (optional)
       * Snap height (optional)       * Snap height (optional)
Line 164: Line 164:
     * Returns an array with:     * Returns an array with:
       * The path and name of the snapshot.       * The path and name of the snapshot.
-      * The page title (if a DokuWiki page id was submited). +      * The page title (if a DokuWiki page id was submitted). 
-      * The target frame for the link to the "snaped" site.+      * The target frame for the link to the "snapped" site.
     * All the snap object properties are also available (see below).     * All the snap object properties are also available (see below).
  
Line 198: Line 198:
     [snapPorts] => 8888 8889 8890 8891 8892                            //Snap server port(s).     [snapPorts] => 8888 8889 8890 8891 8892                            //Snap server port(s).
     [snapTimeout] => 5                                                 //Max duration for a snap (seconds).     [snapTimeout] => 5                                                 //Max duration for a snap (seconds).
-    [tryTimeout] => 3                                                  //Max retries to connect snap serveur.+    [tryTimeout] => 3                                                  //Max retries to connect snap server.
     [checkCache] => 1                                                  //Use snap cache (true/false).     [checkCache] => 1                                                  //Use snap cache (true/false).
     [width] => 200                                                     //Snap width.     [width] => 200                                                     //Snap width.
Line 220: Line 220:
 Output image :/var/www/wiki/data/pages/../snap/start_200x150.jpg Output image :/var/www/wiki/data/pages/../snap/start_200x150.jpg
 content size:1280X1281 content size:1280X1281
-Convert html to image succeeds+Convert HTML to image succeeds
 Resize 200 Resize 200
 Crop 200x150+0+0 Crop 200x150+0+0
Line 228: Line 228:
                                                                        //Can be greater than the snap duration itself if more than one retry was done to connect the snap server.                                                                        //Can be greater than the snap duration itself if more than one retry was done to connect the snap server.
     [tries] => 1                                                       //Tries to connect the snap server.     [tries] => 1                                                       //Tries to connect the snap server.
-    [url] => http://myDokuwikiServer/wiki/doku.php?id=start            //"Snaped" page address.+    [url] => http://myDokuwikiServer/wiki/doku.php?id=start            //"Snapped" page address.
  
     //Inherited properties ------------------------------------------------------------------------------------------     //Inherited properties ------------------------------------------------------------------------------------------
plugin/snap.txt · Last modified: 2017-11-25 21:09 by Aleksandr

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