|
|
<?php
|
|
|
|
|
|
$alea=rand(0,100);
|
|
|
|
|
|
$logo='topisto_vert_tr.png';
|
|
|
|
|
|
$block_image = @imagecreatefrompng($logo);
|
|
|
|
|
|
$width = imagesx($block_image);
|
|
|
$height = imagesy($block_image);
|
|
|
|
|
|
// create the destination/output image.
|
|
|
$img=imagecreatetruecolor( $width, $height );
|
|
|
|
|
|
// enable alpha blending on the destination image.
|
|
|
imagealphablending($img, true);
|
|
|
|
|
|
// Allocate a transparent color and fill the new image with it.
|
|
|
// Without this the image will have a black background instead of being transparent.
|
|
|
$transparent = imagecolorallocatealpha( $img, 255, 255, 255, 127 );
|
|
|
imagefill( $img, 0, 0, $transparent );
|
|
|
|
|
|
// copy the thumbnail into the output image.
|
|
|
imagecopyresampled($img,$block_image, 0, 0, 0, 0, $width, $height, $width, $height );
|
|
|
|
|
|
imagedestroy($block_image);
|
|
|
|
|
|
if ($alea < 1000)
|
|
|
{
|
|
|
$files = glob('logo/tr/topisto_*.png');
|
|
|
usort($files, function($a, $b) {
|
|
|
return filemtime($a) > filemtime($b);
|
|
|
});
|
|
|
|
|
|
shuffle($files);
|
|
|
|
|
|
$superpose = @imagecreatefrompng($files[0]);
|
|
|
|
|
|
//imagecopymerge($img, $superpose, 0, 0, 0, 0, $width, $height, 50);
|
|
|
imagecopyresampled($img,$superpose, 0, 0, 0, 0, $width, $height, imagesx($superpose), imagesy($superpose));
|
|
|
|
|
|
imagedestroy($superpose);
|
|
|
}
|
|
|
|
|
|
imagealphablending($img, false);
|
|
|
imagesavealpha($img,true);
|
|
|
|
|
|
// ---
|
|
|
// --- envoyer l'image au navigateur
|
|
|
// ---
|
|
|
header("Content-Type: image/png");
|
|
|
imagepng($img);
|
|
|
|
|
|
imagedestroy($img);
|
|
|
|
|
|
?>
|