The code below works perfectly fine by itself, but once i try to combine it with any other script, it generates an error.
Warning: Cannot modify header information - headers already sent
The script generates random thumbs and stitches them together. But i need to use the image afterwards. Any suggestions?
$slot1 = rand(1,12);
$slot2 = rand(1,12);
$slot3 = rand(1,12);
$slot4 = rand(1,12);
$slot5 = rand(1,12);
$slot6 = rand(1,12);
// Create image instances
$src = imagecreatefrompng("$slot1.png");
$dest = imagecreate ( 150 , 100 );
// Copy
imagecopy($dest, $src, 0, 0, 0, -50, 150, 100);
$src2 = imagecreatefrompng("$slot2.png");
imagecopy($dest,$src2, 0, 0, 0, 0, 150, 50);
$src5 = imagecreatefrompng("$slot3.png");
imagecopy($dest,$src5, 0, 0, 50, -50, 100, 100);
$src3 = imagecreatefrompng("$slot4.png");
imagecopy($dest,$src3, 0, 0, 50, 0, 100, 50);
$src6 = imagecreatefrompng("$slot5.png");
imagecopy($dest,$src6, 0, 0, 100, -50, 50, 100);
$src4 = imagecreatefrompng("$slot6.png");
imagecopy($dest,$src4, 0, 0, 100, 0, 50, 50);
// Output and free from memory
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
imagedestroy($src2);
imagedestroy($src3);
imagedestroy($src4);
imagedestroy($src5);
imagedestroy($src6);