Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

57 rader
1.4 KiB

<?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, false);
imagesavealpha($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 );
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);
}
imagecopymerge($img, $block_image, 0, 0, 0, 0, $width, $height, 45);
// ---
// --- envoyer l'image au navigateur
// ---
header("Content-Type: image/png");
imagepng($img);
imagedestroy($img);
imagedestroy($block_image);
?>