preload logo pictures

This commit is contained in:
2020-01-09 09:06:31 +01:00
parent ec01340aa7
commit 8dd6659bf8
3 changed files with 58 additions and 21 deletions

View File

@@ -1,6 +1,9 @@
<?php
$alea=rand(0,100);
// valeur par défaut
$rank = -1;
// Surcharge par les arguments
extract($_REQUEST, EXTR_IF_EXISTS);
$logo='topisto_vert_tr.png';
@@ -25,24 +28,26 @@ imagesavealpha($img,true);
// 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);
});
if ($rank < 0)
{
$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);
$rank = 0;
}
// Borner l'index aux valeurs du tableau
$rank = $rank % count($files);
$superpose = @imagecreatefrompng($files[$rank]);
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);
// ---