PlagueInfected Posted May 7, 2009 Share Posted May 7, 2009 I done it before with no problems but now, I'm having issues with this here is my script <div class="load"> <? $d = $_ENV['DOCUMENT_ROOT']; $d = $d."/images/"; $dir = opendir($d); while ($f = readdir($dir)) { $size = getimagesize("images/$f"); echo "<img src=\"images/$f\" $size[3] >"; } header("location: http://plagueinfected.com/tranquildesigns"); ?> </div> Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/ Share on other sites More sharing options...
ignace Posted May 7, 2009 Share Posted May 7, 2009 Add ob_start(); to the beginning of your script or remove the first div btw read this before posting? http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/#findComment-828499 Share on other sites More sharing options...
premiso Posted May 7, 2009 Share Posted May 7, 2009 header reading that will help as well. You cannot make a header call after output (the <div) has been sent to the browser. Simple as that. All header/session_start etc calls must be before output. The ob_start is just a bandaid for the real issue. You should not make any output till after the script runs as a rule of thumb. Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/#findComment-828506 Share on other sites More sharing options...
PlagueInfected Posted May 7, 2009 Author Share Posted May 7, 2009 thanks guys, i rushed into it before reading. haven't been here in a while and im still new to programming. so if i was to use the ob_start() where would i put it or even insert in it, i never used it Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/#findComment-828510 Share on other sites More sharing options...
premiso Posted May 7, 2009 Share Posted May 7, 2009 [quote author=PlagueInfected link=topic=251312.msg1179170#msg1179170 date=1241706383] thanks guys, i rushed into it before reading. haven't been here in a while and im still new to programming. so if i was to use the ob_start() where would i put it or even insert in it, i never used it [/quote] It would have to be before the output as well. So the first item on your page. [code=php:0]<?php ob_start(); ?> <div id="unload"> <?php Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/#findComment-828515 Share on other sites More sharing options...
PlagueInfected Posted May 7, 2009 Author Share Posted May 7, 2009 ok I got it now thanks, man i got more problems now with the newer page lol Link to comment https://forums.phpfreaks.com/topic/157236-getting-an-header-error-when-using-an-image-preloader-than-redirecting/#findComment-828518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.