1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <?php
header("Content-Type: image/PNG");
header("Pragma: no-cache");
//-----------------------------------------------------------
// Image Principale
//-----------------------------------------------------------
//Créer une image
$i= imagecreate ( 1200, 800 ) or die("Impossible d'initialiser la bibliothèque GD");
//Couleur de fond
imagecolorallocate($i, 255, 255, 255);
//Allocation des couleurs pour l'image $i (qui ne sert à rien ici mais que j'utilise dans mon vrai programme :D )
$couleurMulti = array(255, 1279, 2303, 3327, 4351, 5375, 6399, 7423, 8447, 9471, 10495, 11519, 12543, 13567, 14591, 15615, 16639, 17663, 18687, 19711, 20735, 21759, 22783, 23807, 24831, 25855, 26879, 27903, 28927, 29951, 30975, 31999, 33023, 34047, 35071, 36095, 37119, 38143, 39167, 40191, 41215, 42239, 43263, 44287, 45311, 46335, 47359, 48383, 49407, 50431, 51455, 52479, 53503, 54527, 55551, 56575, 57599, 58623, 59647, 60671, 61695, 62719, 63743, 64767, 65532, 65528, 65524, 65520, 65516, 65512, 65508, 65504, 65500, 65496, 65492, 65488, 65484, 65480, 65476, 65472, 65468, 65464, 65460, 65456, 65452, 65448, 65444, 65440, 65436, 65432, 65428, 65424, 65420, 65416, 65412, 65408, 65404, 65400, 65396, 65392, 65388, 65384, 65380, 65376, 65372, 65368, 65364, 65360, 65356, 65352, 65348, 65344, 65340, 65336, 65332, 65328, 65324, 65320, 65316, 65312, 65308, 65304, 65300, 65296, 65292, 65288,65284, 65280, 327424, 589568, 851712, 1113856, 1376000, 1638144, 1900288, 2162432, 2424576, 2686720, 2948864, 3211008, 3473152, 3735296, 3997440, 4259584, 4521728, 4783872, 5046016, 5308160, 5570304, 5832448, 6094592, 6356736, 6618880, 6881024, 7143168, 7405312, 7667456, 7929600, 8191744, 8453888, 8716032, 8978176, 9240320, 9502464, 9764608, 10026752, 10288896, 10551040, 10813184, 11075328, 11337472, 11599616, 11861760, 12123904, 12386048, 12648192, 12910336, 13172480, 13434624, 13696768, 13958912, 14221056, 14483200, 14745344, 15007488, 15269632, 15531776, 15793920, 16056064, 16318208, 16580352, 16776448, 16775424, 16774400, 16773376, 16772352, 16771328, 16770304, 16769280, 16768256, 16767232, 16766208, 16765184, 16764160, 16763136, 16762112, 16761088, 16760064, 16759040, 16758016, 16756992, 16755968, 16754944, 16753920, 16752896, 16751872, 16750848, 16749824,16748800, 16747776, 16746752, 16745728, 16744704, 16743680, 16742656, 16741632, 16740608, 16739584, 16738560, 16737536, 16736512, 16735488, 16734464, 16733440, 16732416, 16731392, 16730368, 16729344, 16728320, 16727296, 16726272, 16725248, 16724224, 16723200, 16722176, 16721152, 16720128, 16719104, 16718080, 16717056, 16716032, 16715008, 16713984, 16712960, 16777215);
for ($t=0;$t<254;$t++)
{
$cc = sprintf("%6X",$couleurMulti[$t] & 16777215);
$red = hexdec ( substr ( $cc, 0, 2 ) );
$green = hexdec ( substr ( $cc, 2, 2 ) );
$blue = hexdec ( substr ( $cc, 4, 2 ) );
$tblCouleur[$t] = imagecolorallocate($i, $red,$green,$blue);
}
//-----------------------------------------------------------
// Image secondaire
//-----------------------------------------------------------
//Créer une image
$test= imagecreate ( 1000, 200 ) or die("Impossible d'initialiser la bibliothèque GD");
//Couleur de fond
$toto = imagecolorallocate($test, 0, 0, 0);
//Affichage du ligne de couleur grise
$couleur = imagecolorallocate($test, 66,66, 66);
$imageline( $test, 0, 0, 1000, 200, $couleur );
imagecopy($i,$test,100,300,0,0,1000,200);
imagepng($i);
imagedestroy($i);
?> |
Partager