onorevolev Posted October 26, 2011 Share Posted October 26, 2011 I'm sure this is an easy answer for someone, but i'm banging my head against the wall. 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); [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/249818-php-header-error/ Share on other sites More sharing options...
trq Posted October 26, 2011 Share Posted October 26, 2011 See: http://www.phpfreaks.com/forums/index.php?topic=37442.0 Link to comment https://forums.phpfreaks.com/topic/249818-php-header-error/#findComment-1282315 Share on other sites More sharing options...
Recommended Posts