Hoi,
Ik heb een stuk code gemaakt, om meerdere .png bestanden naar 1 .png bestand te maken.
Dit doe ik door ze onder elkaar te zetten.
Alleen nu heb ik het probleem dat alles in zwart-wit is, en dit begrijp ik niet.
Kan iemand me dit uitleggen?
(Ook is de background transparant.)
<?php
$location = 'images/';
$images = array('dots.png', 'footer.png');
for($i=0;$i<count($images);$i++){
$src[$i] = imagecreatefrompng($location.$images[$i]);
list($src[$i.'-w'], $src[$i.'-h'], $src[$i.'-t'], $src[$i.'-a']) = getimagesize($location.$images[$i]); // width - height - type - attribute
$totalheight += $src[$i.'-h'];
if($src[$i.'-w'] > $totalwidth){
$totalwidth = $src[$i.'-w'];
}
}
$dest = imagecreate(300, 300);
for($i=0;$i<count($images);$i++){
imagecopy($dest, $src[$i], 0, $nowheight, 0, 0, $src[$i.'-w'], $src[$i.'-h']);
$nowheight += $src[$i.'-h'];
}
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
?>
1.546 views