[ Index ] |
|
Code source de phpMyVisites 2.3 |
1 <?php 2 /** 3 * Exemple d'utilisation de la classe HeatmapFromFile 4 * Use example of HeatmapFromFile class 5 **/ 6 ?> 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 8 <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 9 <head> 10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 11 <title>ClickHeat | Examples</title> 12 </head> 13 <body> 14 <?php 15 exit('Enlevez cette ligne pour que ce fichier marche/Remove this line to make this file work'); 16 17 include './../classes/Heatmap.class.php'; 18 include './../classes/HeatmapFromFile.class.php'; 19 20 $heatmap = new HeatmapFromFile(); 21 /** Ajout d'un fichier à traiter / Adding of a file to parse */ 22 $heatmap->addFile('./coords.txt'); 23 /** 24 * Le format du fichier n'est pas "X,Y", on change donc l'expression régulière (plus d'infos ici : http://fr.php.net/manual/en/reference.pcre.pattern.syntax.php) 25 * File format isn't "X,Y", so we have to change regular expression (more information here : http://us.php.net/manual/en/reference.pcre.pattern.syntax.php) 26 * 27 * 1234,1234 => /^(\d+),(\d+)$/m 28 * 1234x1234 => /^(\d+)x(\d+)$/m 29 * 1234 1234 => /^(\d+) (\d+)$/m 30 * 1234(tab)1234 => /^(\d+)\t(\d+)$/m 31 * 1234,1234,(whatever/n'importe quoi) => /^(\d+),(\d+),.*$/m 32 **/ 33 $heatmap->regular = '/^(\d+)x(\d+)$/m'; 34 /** Fichiers temporaires / Temporary files */ 35 $heatmap->cache = '.'; 36 /** Fichiers générés / Generated files */ 37 $heatmap->path = '.'; 38 /** Fichier final / Final file */ 39 $heatmap->file = 'resultfromfile-%d.png'; 40 /** 41 * On force la hauteur finale (attention à la consommation mémoire dans ce cas !) 42 * Forcing final height (take care of the memory consumption in such case!) 43 **/ 44 $images = $heatmap->generate(200, 100); 45 echo 'Résultats/Results: '; 46 if ($images === false) 47 { 48 echo 'error: '.$heatmap->error; 49 } 50 else 51 { 52 echo '<pre>'; 53 print_r($images); 54 echo '</pre>'; 55 56 echo '<br /><br /><p style="line-height:0;">'; 57 for ($i = 0; $i < $images['count']; $i++) 58 { 59 echo '<img src="', $images['filenames'][$i], '" width="', $images['width'], '" height="', $images['height'], '" alt="" /> Image ', $i, '<br />'; 60 } 61 echo '</p>'; 62 } 63 ?> 64 </body> 65 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |