|
|
<?php
|
|
|
|
|
|
// ---
|
|
|
// --- Listening to blockchain.info to get the last block
|
|
|
// ---
|
|
|
|
|
|
// ---
|
|
|
// --- La config globale
|
|
|
// ---
|
|
|
require_once '../../global/inc/config.php';
|
|
|
|
|
|
// ---
|
|
|
// --- Internal dependances
|
|
|
// ---
|
|
|
require_once APP_PATH.'/blockchain/inc/block.php';
|
|
|
require_once 'inc/splines.php';
|
|
|
|
|
|
// ---
|
|
|
// --- Par défaut on cherche le dernier block
|
|
|
// ---
|
|
|
$block_hash = 'LAST';
|
|
|
|
|
|
// ---
|
|
|
// --- Le cas échéant, on cherche block passé en argument
|
|
|
// ---
|
|
|
if (isset($argv[1])) $block_hash = $argv[1];
|
|
|
|
|
|
$mode=8;
|
|
|
if (isset($argv[2])) $mode=intval($argv[2]);
|
|
|
|
|
|
$iterations = 1;
|
|
|
if ($mode > 2) $iterations = 200;
|
|
|
if (isset($argv[3])) $iterations=intval($argv[3]);
|
|
|
|
|
|
$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);
|
|
|
|
|
|
// création d'une image plus haute pour inclure bandeaux haut et bas
|
|
|
$img = imagecreatetruecolor($img_w, $img_h);
|
|
|
|
|
|
$x0=0; $y0=$bandeau;
|
|
|
$type=2;
|
|
|
if (count($the_block->tx) == 1) $type = 4;
|
|
|
|
|
|
blockchain::DrawBlockHeaderFooter($the_block, $img, $bandeau);
|
|
|
|
|
|
topisto_spline::DrawBlock($the_block, $img, $x0, $y0, $width, $height, $mode, $iterations, $type);
|
|
|
|
|
|
imagepng($img, DATA_PATH.'/spline/'.$the_block->hash.'.png');
|
|
|
|
|
|
imagedestroy($img);
|
|
|
|
|
|
?>
|