Affiche un site sous forme de miniature / Displays a site as a snapshot
html2image: the tool that does the URL snapshot.Xvfb: a virtual X server.convert: an image processing command from ImageMagick, that allows to resize and crop images (and much more).netcat: a small network software that does a lot of things, such as listen on a port and answer with a specified program.server.sh)netcat)snap.sh)html2image)convert)convert)helper.php) that launches the snapshot by connecting the snapshot server and sending it the required parameters.syntax.php) that reads the syntax to get the parameters and call the helper.html2image directly from a PHP page, you get a pagination fault error..jpg file on the hard drive (into ./data/snap for example).start_300x200.jpg)$conf['cachetime']), it is not generated again (unless you ask to force snapshot without using the cache (see below))helper.php file to do this right.html2image used by the snap server doesn't render the flash objects.root, install html2image into /usr/lib/html2image for example (download it here: http://www.guangmingsoft.net/htmlsnapshot/html2image.htm)./html2image/greprefs/all.js. Example :pref("network.proxy.autoconfig_url", "http://myProxy/myScript"); pref("network.proxy.type", 2);
<path to html2image> (for example /usr/lib/html2image) into the file /etc/ld.so.conf.d/html2image.conf (create it)ldconfig to activate the changes.html2image.Xvfb is installed (Xvfb - → doit afficher la liste des options)apt-get install xvfbapt-get remove xfonts-base; apt-get install xfonts-base)Xvfb :1 -screen 0 640x480x24 -nolisten tcp -fp /usr/share/fonts/X11/misc& (provide another fp if your fonts are elsewhere (fp=font path)export DISPLAY=:1cd /usr/lib/html2image; ./html2image www.google.com /tmp/try.jpg/tmp/try.jpg exists and it contains a pretty snapshotpkill Xvfb)nc is installed (nc -h → v1.10)apt-get install netcatconvert is installed (convert -version → v6.2.4)apt-get install imagemagickroot:/var/www/wiki/data/snap (for example)chmod 777 /var/www/wiki/data/snap)root” profile/var/www/wiki/lib/plugins/snap/server.sh/var/www/wiki/lib/plugins/snap/server.sh &/var/www/wiki/lib/plugins/snap/helper.php)[[site_url]]) changed into a picture ({{picture_url}}) → {{[[site_url]]}}start, fr:plugin:snap, aso…){{[[start|!]]}}{{[[start|100!]]}} (100 px width and don't use snap cache)helper.php to change those values, and others (helper reference).imFactor parameter to calculate the missing dimension.syntax plugin:[...] $snap=plugin_load('helper','snap'); if (!$snap) { $renderer->doc .= "<b>SNAP:</b> Snap helper not found<br />"; return false; } list($imagePath, $pageTitle, $target)=$snap->getSnap($param, $width, $height, $checkCache); if (!$snap->succeed || !$imagePath) { $renderer->doc .= "<b>SNAP:</b> Problem during the snap of $param<br />"; return false; } [...]
helper_plugin_snap Object
(
//Read/Write properties -----------------------------------------------------------------------------------------
[defaultWiki] => http://myDokuwikiServer/wiki/doku.php?id= //Base address used to snap DokuWiki page ID.
[screenx] => 1280 //Width of the virtual browser into which the snap is done.
[screeny] => 1024 //Height of the virtual browser into which the snap is done.
[imFactor] => 1.33333333333 //width/height image proportion.
[defLarg] => 200 //Default width of the snaps.
[defHaut] => 150 //Default height of the snaps.
[maxLarg] => 400 //Max width allowed for the snaps.
[maxHaut] => 300 //Max height allowed for the snaps.
[snapServer] => localhost //Snap server address.
[snapPorts] => 8888 8889 8890 8891 8892 //Snap server port(s).
[snapTimeout] => 5 //Max duration for a snap (seconds).
[tryTimeout] => 3 //Max retries to connect snap server.
[checkCache] => 1 //Use snap cache (true/false).
[width] => 200 //Snap width.
[height] => 150 //Snap height.
[outputPath] => /var/www/wiki/data/pages/../snap/ //Directory to store the snaps.
//Read only properties ------------------------------------------------------------------------------------------
[imagePath] => /var/www/wiki/data/pages/../snap/start_200x150.jpg //Path and name of the current snap.
[titrePage] => My page title //Page title (if a DokuWiki page ID was submitted).
[snapTime] => 1224068749 //Snap time.
//Can be different of the snap launch time if the snap was found into the cache.
[snapTimeFormatted] => 15/10/2008 13:05 //Formatted snap date (uses $conf['dformat']).
[fromCache] => //Snap found into the cache (true/false).
[succeed] => 1 //Snap successful (true/false).
[target] => //Target of the link (uses $conf['target']['extern'] and $conf['target']['wiki']).
[selectedPort] => 8890 //Port used for this snap.
[snapLog] => Width :1280 //Snap log (the password are hidden).
Height :1024
Time Out :5000
URL :http://myDokuwikiServer/wiki/doku.php?id=start&u=myLogin&phash=******
Output image :/var/www/wiki/data/pages/../snap/start_200x150.jpg
content size:1280X1281
Convert HTML to image succeeds
Resize 200
Crop 200x150+0+0
[timeout] => //Timeout detected during the snap (true/false).
[snapDuration] => 2 //Snap duration (seconds).
[snapTotalDuration] => 2 //Total duration (seconds).
//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.
[url] => http://myDokuwikiServer/wiki/doku.php?id=start //"Snapped" page address.
//Inherited properties ------------------------------------------------------------------------------------------
[allowedModesSetup] =>
[localised] =>
[lang] => Array
(
)
[configloaded] =>
[conf] => Array
(
)
[Lexer] =>
[allowedModes] => Array
(
)
)