first commit
106
images/20170200-content.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<div class="container-fluid bg-grey">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h2>A digital currency</h2>
|
||||
<p>
|
||||
Use cryptography.<br>
|
||||
No "central bank".<br>
|
||||
P2P network.<br>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-4 align-middle">
|
||||
<img src="images/bitcoin.jpg" width="100%; height: auto"></img>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 align-middle">
|
||||
<img src="images/wallet.png" height="300px"></img>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h2>WALLET</h2>
|
||||
<p>
|
||||
Use cryptography.<br>
|
||||
No "central bank".<br>
|
||||
P2P network.<br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid bg-grey">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h2>Transaction</h2>
|
||||
<p>
|
||||
When Bob is sending 42 <span class="glyphicon glyphicon-bitcoin"></span> to Alice, the bitcoin protocol is creating a transaction.<br>
|
||||
A transaction is the balance between his Inputs and his Outputs.
|
||||
<ul>
|
||||
<li>First the network needs to be sure that Bob has got enough <span class="glyphicon glyphicon-bitcoin"></span> in his wallet.<br>So Bob will include a list of transactions that he has received before.<br>This is the inputs of the transactions.<br>For example, previous transaction's amount are 10, 25 and another 10, so total inputs are 45 <span class="glyphicon glyphicon-bitcoin"></span></li>
|
||||
<li>As the input's sum is superior to the amount of the transaction, an ouput is added.<br>This output is the change to Bob.<br>In the example, this 3 <span class="glyphicon glyphicon-bitcoin"></span></li>
|
||||
<li>Fees are took by the network to process the transaction.<br>Let say it will take 0.5<span class="glyphicon glyphicon-bitcoin"></span>.<br>This is another ouput</li>
|
||||
<li>So Alice will get only a part of the transaction's amount.<br>this the last output, 41.5<span class="glyphicon glyphicon-bitcoin"></span></li>
|
||||
</ul>
|
||||
So the transaction is a made with :
|
||||
<ul>
|
||||
<li>Inputs : a list of previous transactions that bob has received</li>
|
||||
<li>Outputs : a list of amounts to send to Alice, Bob, and fees</li>
|
||||
<li>A timestamp</li>
|
||||
</ul>
|
||||
Then the wallet will broadcast the transaction on the network.<br>
|
||||
It will be sent to the area called "mempool".<br>
|
||||
Nodes of the network will validate the transaction by verfying the Inputs and the Ouputs.<br>
|
||||
A hash of the transaction is computed.<br>
|
||||
So the transaction is sealed.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-4 align-middle">
|
||||
<img src="images/bob_to_alice.gif" width="100%; height: auto"></img>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<img src="images/tx2block.gif" width="100%; height: auto"></img>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h2>Block</h2>
|
||||
<p>
|
||||
Then the bitcoin protocol is grouping validated transactions in blocks.<br>
|
||||
So a block is an array of transactions.<br>
|
||||
A block is made with :
|
||||
<ul>
|
||||
<li>An array of transactions.<br>
|
||||
That's what my script is drawing.<br>
|
||||
Running the transactions array, it is computing the sum of each outputs of each transaction.<br>
|
||||
Then, it draws a rectangle for each sum.<br>
|
||||
</li>
|
||||
<li>A "proof of work".<br>The miner is computing a special hash that depends on the array of transaction and that will answer to a constraint.<br>This hash is very difficult to compute. In fact it is not really computed, the miner must test every value until he find the solution.<br></li>
|
||||
<li>That why the network will give him a reward.<br>This is a special transaction that has no inputs.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid bg-grey">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h2>Blockchain</h2>
|
||||
<p>
|
||||
Each block has a hash and a reference to the ihash of the previous block.<br>
|
||||
So blocks are chained together.<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<img src="/images/loading.gif" width="100%; height: auto"></img>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
BIN
images/Bitcoin_Network_Blue.jpg
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
images/D3-force-driven-graph.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
21
images/R_TOPISTO_image.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$type='spline';
|
||||
if (isset($_REQUEST['type'])) $type=$_REQUEST['type'];
|
||||
|
||||
$files = glob('/opt/TOPISTO/data/'.$type.'/*.png');
|
||||
usort($files, function($a, $b) {
|
||||
return filemtime($a) > filemtime($b);
|
||||
});
|
||||
|
||||
$block_image = @imagecreatefrompng($files[0]);
|
||||
|
||||
// ---
|
||||
// --- envoyer l'image au navigateur
|
||||
// ---
|
||||
header("Content-Type: image/png");
|
||||
imagepng($block_image);
|
||||
|
||||
imagedestroy($block_image);
|
||||
|
||||
?>
|
||||
BIN
images/bandeau.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
images/bitcoin.jpg
Normal file
|
After Width: | Height: | Size: 831 KiB |
231
images/block_image.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
function tri_filemtime( $a, $b ) { return filemtime($a) - filemtime($b); }
|
||||
|
||||
// ---
|
||||
// --- La config globale
|
||||
// ---
|
||||
chdir('/opt/TOPISTO/apps');
|
||||
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
||||
|
||||
// ---
|
||||
// --- External dependances
|
||||
// ---
|
||||
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
||||
|
||||
// ---
|
||||
// --- Internal dependances
|
||||
// ---
|
||||
require_once APP_PATH.'/blockchain/inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = '*';
|
||||
$methode='hasard';
|
||||
$mode=9999;
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
|
||||
if (isset($_REQUEST['methode'])) $methode = $_REQUEST['methode'];
|
||||
if (isset($_REQUEST['mode'])) $mode = intval($_REQUEST['mode']);
|
||||
|
||||
$img = null;
|
||||
|
||||
// ---
|
||||
// --- Le cas général : on trouve le fichier image demandé
|
||||
// ---
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash;
|
||||
if ($mode != 9999) $imagefilename .= '-'.$mode;
|
||||
$imagefilename .= '.png';
|
||||
if (file_exists($imagefilename)) $img = imagecreatefrompng($imagefilename);
|
||||
|
||||
// ---
|
||||
// --- "strict" est un flag qui indique que l'on veut précisément
|
||||
// --- ce que les paramètres demandent
|
||||
// ---
|
||||
if (($img==null)&&(!isset($_REQUEST['strict'])))
|
||||
{
|
||||
//
|
||||
// On n'a pas passé de HASH
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On prend le dernier connu pour la méthode et le mode
|
||||
//
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*-'.$mode.'.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, tri_filemtime );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
//
|
||||
// On prend le dernier connu pour la méthode tout mode confondu
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, tri_filemtime );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On a passé un HASH
|
||||
//
|
||||
if (($img==null)&&(isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On cherche le bon HASH et la bonne méthode
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
//
|
||||
// En fait on s'en fiche de la méthode tant qu'on a le bon HASH
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/hasard/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On n'a rien trouvé, donc on dessine ce qui est demandé
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
if ($mode == 9999) $mode = 0;
|
||||
if ($block_hash == '*') $block_hash = blockchain::getLastCacheBlockHash();
|
||||
if ($methode == 'hasard') $methode = 'treemap';
|
||||
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
|
||||
$the_name = blockchain::hash2SpecialName($the_block->hash);
|
||||
if ($the_name == $the_block->hash) $the_name ='';
|
||||
|
||||
$bandeau = 50;
|
||||
$marge = 25;
|
||||
$text_border = 20;
|
||||
$width = GRAPH_WIDTH;
|
||||
$height = GRAPH_HEIGHT;
|
||||
|
||||
// Pour que l'image simple ait les proportions que l'image full
|
||||
$width = $marge + ($width*2) + (2*$text_border);
|
||||
$height = $marge + ($height*2);
|
||||
|
||||
$img_w = $width;
|
||||
$img_h = $height+(2*$bandeau);
|
||||
|
||||
$type=2;
|
||||
if (count($the_block->tx)==1) $type=4;
|
||||
|
||||
// création d'une image plus haute pour inclure bandeaux haut et bas
|
||||
$img = imagecreatetruecolor($img_w, $img_h);
|
||||
|
||||
$param0 = blockchain::DrawBlockHeaderFooter($the_block, $img, $bandeau);
|
||||
|
||||
$parametres = [];
|
||||
$parametres['x'] = 0;
|
||||
$parametres['y'] = $bandeau;
|
||||
$parametres['width'] = $width;
|
||||
$parametres['height'] = $height;
|
||||
$parametres['methode'] = $mode;
|
||||
$parametres['type'] = $type;
|
||||
$parametres['transparent_color'] = $param0[0];
|
||||
$parametres['background_color'] = $param0[1];
|
||||
$parametres['font_color'] = $param0[2];
|
||||
$parametres['fontname'] = $param0[3];
|
||||
$parametres['font_RGB'] = $param0[4];
|
||||
$parametres['background_RGB'] = $param0[5];
|
||||
|
||||
switch($methode)
|
||||
{
|
||||
case 'veraMolnar':
|
||||
require_once APP_PATH.'/methode/veraMolnar/inc/treemap.php';
|
||||
topisto_veraMolnar::DrawBlock($the_block, $img, $parametres);
|
||||
break;
|
||||
|
||||
case 'treemapV2':
|
||||
require_once APP_PATH.'/methode/treemapV2/inc/treemap.php';
|
||||
topisto_treemap::DrawBlock($the_block, $img, $parametres);
|
||||
break;
|
||||
|
||||
case 'treemap_fuzzy':
|
||||
require_once APP_PATH.'/methode/treemap_fuzzy/inc/treemap.php';
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
|
||||
case 'spline':
|
||||
require_once APP_PATH.'/methode/spline/inc/splines.php';
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
|
||||
case 'spline_2':
|
||||
require_once APP_PATH.'/methode/spline/inc/splines.php';
|
||||
topisto_spline::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, 200, $type);
|
||||
break;
|
||||
|
||||
case 'treemap' :
|
||||
default:
|
||||
require_once APP_PATH.'/methode/treemap/inc/treemap.php';
|
||||
topisto_treemap::DrawBlock($the_block, $img, 0, $bandeau, $width, $height, $mode, $type);
|
||||
break;
|
||||
}
|
||||
|
||||
// Les textes
|
||||
/*
|
||||
* INUTILE depuis que blockchain::DrawBlockHeaderFooter ajoute elle-même les textes
|
||||
*
|
||||
putenv('GDFONTPATH='.RESS_PATH.'/fonts/');
|
||||
$font = 'DS-DIGIB.TTF';
|
||||
|
||||
$fontColor = imagecolorallocate($img, 227,227,153);
|
||||
$the_texte = "Height : ".$the_block->height;
|
||||
imagettftext($img,18, 0, 5, $bandeau-5, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Inputs : ".$the_block->topisto_inputs;
|
||||
if ($type == 4) $the_texte = "Reward : ".$the_block->topisto_reward;
|
||||
imagettftext($img,15, 0, 5, $bandeau+$height+18, $fontColor, $font, $the_texte);
|
||||
|
||||
if ($the_name == '') $the_name = date('Ymd H:m:s', $the_block->time);
|
||||
$bbox = imagettfbbox(14, 0, $font, $the_name);
|
||||
imagettftext($img, 14, 0, ($img_w-3)-($bbox[2]-$bbox[0]), ($bandeau-5), $fontColor, $font, $the_name);
|
||||
*/
|
||||
|
||||
// Sauvegarder l'image et ajouter
|
||||
// - un lien sur le mode
|
||||
// - un lien dans le dossier "hasard"
|
||||
$imagefilename2 = str_replace(".png","-$mode.png", $imagefilename);
|
||||
imagepng($img,$imagefilename2);
|
||||
|
||||
if (!file_exists($imagefilename)) link($imagefilename2, $imagefilename);
|
||||
|
||||
$imagefilename2 = str_replace("methode/$methode/","methode/hasard/", $imagefilename);
|
||||
if (!file_exists($imagefilename2)) link($imagefilename, $imagefilename2);
|
||||
}
|
||||
|
||||
$seconds_to_cache = 7200;
|
||||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
||||
header("Expires: $ts");
|
||||
header("Pragma: cache");
|
||||
header("Cache-Control: max-age=$seconds_to_cache");
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($img);
|
||||
|
||||
imagedestroy($img);
|
||||
|
||||
?>
|
||||
BIN
images/blockchain.gif
Normal file
|
After Width: | Height: | Size: 268 KiB |
BIN
images/bob_to_alice.gif
Normal file
|
After Width: | Height: | Size: 376 KiB |
BIN
images/bob_to_alice.jpg
Normal file
|
After Width: | Height: | Size: 99 KiB |
BIN
images/btcfond.jpg
Normal file
|
After Width: | Height: | Size: 59 KiB |
53
images/cached_block_image.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
// ---
|
||||
// --- La config globale
|
||||
// ---
|
||||
chdir('/opt/TOPISTO/apps');
|
||||
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
||||
|
||||
// ---
|
||||
// --- External dependances
|
||||
// ---
|
||||
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
||||
|
||||
// ---
|
||||
// --- Internal dependances
|
||||
// ---
|
||||
require_once APP_PATH.'/blockchain/inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = '*';
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
|
||||
|
||||
$img = null;
|
||||
|
||||
$myarray = glob(DATA_PATH.'/hasard/'.$block_hash.'.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
|
||||
$seconds_to_cache = 7200;
|
||||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
||||
header("Expires: $ts");
|
||||
header("Pragma: cache");
|
||||
header("Cache-Control: max-age=$seconds_to_cache");
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($img);
|
||||
|
||||
imagedestroy($img);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once('block_image.php');
|
||||
|
||||
?>
|
||||
109
images/debug_block_image.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
// ---
|
||||
// --- La config globale
|
||||
// ---
|
||||
chdir('/opt/TOPISTO/apps');
|
||||
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
||||
|
||||
// ---
|
||||
// --- External dependances
|
||||
// ---
|
||||
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
||||
|
||||
// ---
|
||||
// --- Internal dependances
|
||||
// ---
|
||||
require_once APP_PATH.'/blockchain/inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = '*';
|
||||
$methode='hasard';
|
||||
$mode=9999;
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
|
||||
if (isset($_REQUEST['methode'])) $methode = $_REQUEST['methode'];
|
||||
if (isset($_REQUEST['mode'])) $mode = intval($_REQUEST['mode']);
|
||||
|
||||
//$methode = str_replace('full_', '', $methode);
|
||||
|
||||
$img = null;
|
||||
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'-'.$mode.'.png';
|
||||
echo $imagefilename;
|
||||
if (file_exists($imagefilename)) echo ' <font color="green">OK</font><br>'.PHP_EOL;
|
||||
else echo ' <font color="red">KO</font><br>'.PHP_EOL;
|
||||
|
||||
//
|
||||
// "strict" est un flag qui indique que l'on veut précisément
|
||||
// ce que les paramètres demandent
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['strict'])))
|
||||
{
|
||||
//
|
||||
// On n'a pas passé de HASH
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On prend le dernier connu pour la méthode et le mode
|
||||
//
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*-'.$mode.'.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
|
||||
echo $myarray[0].' <font color="green">OK</font><br>'.PHP_EOL;
|
||||
$img=true;
|
||||
}
|
||||
//
|
||||
// On prend le dernier connu pour la méthode tout mode confondu
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
|
||||
echo $myarray[0].' <font color="green">OK</font><br>'.PHP_EOL;
|
||||
$img=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On a passé un HASH
|
||||
//
|
||||
if (($img==null)&&(isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On cherche le bon HASH et la bonne méthode
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
echo $imagefilename.' <font color="green">OK</font><br>'.PHP_EOL;
|
||||
$img=true;
|
||||
}
|
||||
//
|
||||
// En fait on s'en fiche de la méthode tant qu'on a le bon HASH
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/hasard/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
echo $imagefilename.' <font color="green">OK</font><br>'.PHP_EOL;
|
||||
$img=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On n'a rien trouvé, donc on dessine ce qui est demandé
|
||||
//
|
||||
if ($img==null) echo '<font color="red">KO</font><br>';
|
||||
|
||||
?>
|
||||
237
images/full_block_image.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
// ---
|
||||
// --- La config globale
|
||||
// ---
|
||||
chdir('/opt/TOPISTO/apps');
|
||||
require_once '/opt/TOPISTO/apps/global/inc/config.php';
|
||||
|
||||
// ---
|
||||
// --- External dependances
|
||||
// ---
|
||||
require TOPISTO_PATH.'/ressources/vendor/autoload.php';
|
||||
|
||||
// ---
|
||||
// --- Internal dependances
|
||||
// ---
|
||||
require_once APP_PATH.'/blockchain/inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = '*';
|
||||
$methode='hasard';
|
||||
$mode=9999;
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($_REQUEST['hash'])) $block_hash = $_REQUEST['hash'];
|
||||
if (isset($_REQUEST['methode'])) $methode = $_REQUEST['methode'];
|
||||
if (isset($_REQUEST['mode'])) $mode = intval($_REQUEST['mode']);
|
||||
|
||||
//$methode = str_replace('full_', '', $methode);
|
||||
|
||||
$img = null;
|
||||
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'-'.$mode.'.png';
|
||||
if (file_exists($imagefilename))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
|
||||
//
|
||||
// "strict" est un flag qui indique que l'on veut précisément
|
||||
// ce que les paramètres demandent
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['strict'])))
|
||||
{
|
||||
//
|
||||
// On n'a pas passé de HASH
|
||||
//
|
||||
if (($img==null)&&(!isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On prend le dernier connu pour la méthode et le mode
|
||||
//
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*-'.$mode.'.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
//
|
||||
// On prend le dernier connu pour la méthode tout mode confondu
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
$myarray = glob(DATA_PATH.'/'.$methode.'/*.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($a) - filemtime($b); } );
|
||||
$img = imagecreatefrompng($myarray[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On a passé un HASH
|
||||
//
|
||||
if (($img==null)&&(isset($_REQUEST['hash'])))
|
||||
{
|
||||
//
|
||||
// On cherche le bon HASH et la bonne méthode
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
//
|
||||
// En fait on s'en fiche de la méthode tant qu'on a le bon HASH
|
||||
//
|
||||
$imagefilename = DATA_PATH.'/hasard/'.$block_hash.'.png';
|
||||
if (($img==null)&&(file_exists($imagefilename)))
|
||||
{
|
||||
$img = imagecreatefrompng($imagefilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// On n'a rien trouvé, donc on dessine ce qui est demandé
|
||||
//
|
||||
if ($img==null)
|
||||
{
|
||||
if ($mode == 9999) $mode = 0;
|
||||
if ($block_hash == '*') $block_hash = blockchain::getLastCacheBlockHash();
|
||||
|
||||
$imagefilename = DATA_PATH.'/'.$methode.'/'.$block_hash.'.png';
|
||||
|
||||
switch($methode)
|
||||
{
|
||||
case 'full_treemap_fuzzy':
|
||||
require_once APP_PATH.'/methode/treemap_fuzzy/inc/treemap.php';
|
||||
$imagefilename = DATA_PATH.'/full_treemap_fuzzy/'.$block_hash.'.png';
|
||||
break;
|
||||
|
||||
case 'full_spline':
|
||||
require_once APP_PATH.'/methode/spline/inc/splines.php';
|
||||
$imagefilename = DATA_PATH.'/full_spline/'.$block_hash.'.png';
|
||||
break;
|
||||
|
||||
case 'full_treemap' :
|
||||
default:
|
||||
require_once APP_PATH.'/methode/treemap/inc/treemap.php';
|
||||
$imagefilename = DATA_PATH.'/full_treemap/'.$block_hash.'-'.$mode.'.png';
|
||||
}
|
||||
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
|
||||
$the_name = blockchain::hash2SpecialName($the_block->hash);
|
||||
if ($the_name == $the_block->hash) $the_name ='';
|
||||
|
||||
$bandeau = 50;
|
||||
$marge = 25;
|
||||
$text_border = 20;
|
||||
$width = GRAPH_WIDTH;
|
||||
$height = GRAPH_HEIGHT;
|
||||
|
||||
$img_w = $marge + ($width*2) + (2*$text_border);
|
||||
$img_h = $marge + ($height*2) + (2*$bandeau);
|
||||
|
||||
// création d'une image plus haute pour inclure bandeaux haut et bas
|
||||
$img = imagecreatetruecolor( $img_w, $img_h);
|
||||
|
||||
// Les parties du block : inputs, outputs, fees, reward
|
||||
switch($methode)
|
||||
{
|
||||
case 'full_treemap_fuzzy':
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, $text_border + 0, $bandeau, $width, $height, $mode, 2);
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, $text_border+$marge+$width, $bandeau, $width, $height, $mode, 1);
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, $text_border+0, $marge+$height + $bandeau, $width, $height, $mode, 3);
|
||||
topisto_treemap_fuzzy::DrawBlock($the_block, $img, $text_border+$marge+$width, $marge+$height + $bandeau, $width, $height, $mode, 4);
|
||||
break;
|
||||
|
||||
case 'full_spline':
|
||||
$type=2;
|
||||
$x0 = $text_border; $y0 = $bandeau;
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, $x0, $y0, $width, $height, $type);
|
||||
|
||||
$type=1;
|
||||
$x0 = $text_border+$marge+$width; $y0 = $bandeau;
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, $x0, $y0, $width, $height, $type);
|
||||
|
||||
$type=3;
|
||||
$x0 = $text_border; $y0 = $marge+$height+$bandeau;
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, $x0, $y0, $width, $height, $type);
|
||||
|
||||
$type=4;
|
||||
$x0 = $text_border+$marge+$width; $y0 = $marge+$height+$bandeau;
|
||||
topisto_spline::DefaultDrawBlock($the_block, $img, $x0, $y0, $width, $height, $type);
|
||||
break;
|
||||
|
||||
case 'full_treemap':
|
||||
default:
|
||||
topisto_treemap::DrawBlock($the_block, $img, $text_border + 0, $bandeau, $width, $height, $mode, 2);
|
||||
topisto_treemap::DrawBlock($the_block, $img, $text_border+$marge+$width, $bandeau, $width, $height, $mode, 1);
|
||||
topisto_treemap::DrawBlock($the_block, $img, $text_border+0, $marge+$height + $bandeau, $width, $height, $mode, 3);
|
||||
topisto_treemap::DrawBlock($the_block, $img, $text_border+$marge+$width, $marge+$height + $bandeau, $width, $height, $mode, 4);
|
||||
break;
|
||||
}
|
||||
|
||||
blockchain::DrawBlockHeaderFooter($the_block, $img, $bandeau);
|
||||
|
||||
$fond = imagecolorallocate($img, 40, 40, 40);
|
||||
imagefilledrectangle($img, 0, $bandeau, $text_border, $img_h-$bandeau, $fond);
|
||||
imagefilledrectangle($img, $img_w-$text_border, $bandeau, $img_w, $img_h-$bandeau, $fond);
|
||||
imagefilledrectangle($img, $text_border+$width, $bandeau, $text_border+$marge+$width, $img_h-$bandeau, $fond);
|
||||
imagefilledrectangle($img, 0, $bandeau+$height, $img_w - $text_border, $bandeau+$marge+$height, $fond);
|
||||
|
||||
// Les textes
|
||||
putenv('GDFONTPATH='.RESS_PATH.'/fonts/');
|
||||
$font = 'DS-DIGIB.TTF';
|
||||
|
||||
$fontColor = imagecolorallocate($img, 158,227,253);
|
||||
$fontColor = imagecolorallocate($img, 227,253,158);
|
||||
$fontColor = imagecolorallocate($img, 227,227,153);
|
||||
|
||||
$the_texte = "Height : ".$the_block->height;
|
||||
imagettftext($img,18, 0, 5, $bandeau-5, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Inputs : ".$the_block->topisto_inputs;
|
||||
imagettftext($img,15, 90, $text_border-3, $bandeau+$height, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Outputs : ".$the_block->topisto_outputs;
|
||||
imagettftext($img,15, 90, $text_border+$width+$marge-3, $bandeau+$height, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Fees : ".$the_block->topisto_fees;
|
||||
imagettftext($img,15, 90, $text_border-3, $bandeau+(2*$height)+$marge-3, $fontColor, $font, $the_texte);
|
||||
$the_texte = "Reward : ".$the_block->topisto_reward;
|
||||
imagettftext($img,15, 90, $text_border+$width+$marge-3, $bandeau+(2*$height)+$marge-3, $fontColor, $font, $the_texte);
|
||||
|
||||
if ($the_name == '') $the_name = date('Ymd H:m:s', $the_block->time);
|
||||
$bbox = imagettfbbox(14, 0, $font, $the_name);
|
||||
imagettftext($img, 14, 0, ($img_w-3)-($bbox[2]-$bbox[0]), ($bandeau-5), $fontColor, $font, $the_name);
|
||||
|
||||
// Sauvegarder l'image et ajouter
|
||||
// - un lien sur le mode
|
||||
// - un lien dans le dossier "hasard"
|
||||
$imagefilename2 = str_replace(".png","-$mode.png", $imagefilename);
|
||||
imagepng($img,$imagefilename2);
|
||||
|
||||
if (!file_exists($imagefilename)) link($imagefilename2, $imagefilename);
|
||||
|
||||
$imagefilename2 = str_replace("methode/$methode/","methode/hasard/", $imagefilename);
|
||||
if (!file_exists($imagefilename2)) link($imagefilename, $imagefilename2);
|
||||
}
|
||||
|
||||
$seconds_to_cache = 7200;
|
||||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
||||
header("Expires: $ts");
|
||||
header("Pragma: cache");
|
||||
header("Cache-Control: max-age=$seconds_to_cache");
|
||||
header('Content-Type: image/png');
|
||||
|
||||
imagepng($img);
|
||||
imagedestroy($img);
|
||||
|
||||
?>
|
||||
BIN
images/loading.gif
Normal file
|
After Width: | Height: | Size: 34 KiB |
29
images/logo.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$alea=rand(0,100);
|
||||
|
||||
$logo='topisto_vert.png';
|
||||
|
||||
if ($alea > 30)
|
||||
{
|
||||
$files = glob('logo/medium/*/topisto_vert.png');
|
||||
usort($files, function($a, $b) {
|
||||
return filemtime($a) > filemtime($b);
|
||||
});
|
||||
|
||||
shuffle($files);
|
||||
|
||||
$logo = $files[0];
|
||||
}
|
||||
|
||||
$block_image = @imagecreatefrompng($logo);
|
||||
|
||||
// ---
|
||||
// --- envoyer l'image au navigateur
|
||||
// ---
|
||||
header("Content-Type: image/png");
|
||||
imagepng($block_image);
|
||||
|
||||
imagedestroy($block_image);
|
||||
|
||||
?>
|
||||
BIN
images/logo/big/big_boxfitting/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
images/logo/big/big_boxfitting/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
images/logo/big/big_delaunay/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 764 KiB |
BIN
images/logo/big/big_delaunay/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 823 KiB |
BIN
images/logo/big/big_op_art/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
images/logo/big/big_op_art/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
images/logo/big/big_rodillus1/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 883 KiB |
BIN
images/logo/big/big_rodillus1/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
images/logo/big/big_rodillus2/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
images/logo/big/big_rodillus2/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
images/logo/big/big_shapeism/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
images/logo/big/big_shapeism/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
images/logo/big/big_shockwave/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
images/logo/big/big_shockwave/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 3.6 MiB |
BIN
images/logo/big/big_stainglass/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 784 KiB |
BIN
images/logo/big/big_stainglass/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 726 KiB |
BIN
images/logo/big/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
images/logo/big/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
4
images/logo/gmic.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
for toto in rouge vert
|
||||
do
|
||||
gmic ../topisto_$toto.png $@ -output topisto_$toto.png
|
||||
done
|
||||
BIN
images/logo/medium/boxfitting/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
images/logo/medium/boxfitting/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
images/logo/medium/delaunay/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
images/logo/medium/delaunay/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 161 KiB |
BIN
images/logo/medium/dream_smooth/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 211 KiB |
BIN
images/logo/medium/dream_smooth/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 238 KiB |
BIN
images/logo/medium/felt_pen/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
images/logo/medium/felt_pen/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000000.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000001.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000002.png
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000003.png
Normal file
|
After Width: | Height: | Size: 203 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000004.png
Normal file
|
After Width: | Height: | Size: 204 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000005.png
Normal file
|
After Width: | Height: | Size: 204 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000006.png
Normal file
|
After Width: | Height: | Size: 205 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000007.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000008.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000009.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000010.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000011.png
Normal file
|
After Width: | Height: | Size: 209 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000012.png
Normal file
|
After Width: | Height: | Size: 211 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000013.png
Normal file
|
After Width: | Height: | Size: 211 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000014.png
Normal file
|
After Width: | Height: | Size: 211 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000015.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000016.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000017.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000018.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
images/logo/medium/fire_edges/topisto_rouge_000019.png
Normal file
|
After Width: | Height: | Size: 214 KiB |
BIN
images/logo/medium/illustration_look/topisto.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
images/logo/medium/illustration_look/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
images/logo/medium/illustration_look/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 233 KiB |
BIN
images/logo/medium/imagegrid_16/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
images/logo/medium/imagegrid_16/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
images/logo/medium/imagegrid_32/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
images/logo/medium/imagegrid_32/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
images/logo/medium/imagegrid_4/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
images/logo/medium/imagegrid_4/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
images/logo/medium/imagegrid_64/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
images/logo/medium/imagegrid_64/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
images/logo/medium/imagegrid_8/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
images/logo/medium/imagegrid_8/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
images/logo/medium/lava/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
images/logo/medium/lava/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 235 KiB |
BIN
images/logo/medium/linify/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 415 KiB |
BIN
images/logo/medium/linify/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 402 KiB |
BIN
images/logo/medium/maze/topisto_1.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
images/logo/medium/mineral_mozaic/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
images/logo/medium/mineral_mozaic/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
images/logo/medium/novel_fx/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 182 KiB |
BIN
images/logo/medium/novel_fx/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 205 KiB |
BIN
images/logo/medium/op_art/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
images/logo/medium/op_art/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
images/logo/medium/poster_hope/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
images/logo/medium/poster_hope/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
images/logo/medium/quadtree_variation/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 146 KiB |
BIN
images/logo/medium/quadtree_variation/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
images/logo/medium/rodillus1/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 176 KiB |
BIN
images/logo/medium/rodillus1/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 287 KiB |
BIN
images/logo/medium/rodillus2/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 177 KiB |
BIN
images/logo/medium/rodillus2/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 281 KiB |
BIN
images/logo/medium/scale/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
images/logo/medium/scale/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
images/logo/medium/shapeism/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
images/logo/medium/shapeism/topisto_vert.png
Normal file
|
After Width: | Height: | Size: 192 KiB |
BIN
images/logo/medium/showkwaves/topisto_rouge.png
Normal file
|
After Width: | Height: | Size: 434 KiB |