vanderlay Posted May 14, 2007 Share Posted May 14, 2007 Hi All, I have been using php for some time now and have got the hang of fairly high level processing including dynamic images from mysql output that leads me to the point of needing to better understand the processing /logic order of the php engine so i can increase the speed of my scripts. so the Q i have is how is the following rendered by php, template.php require -> mysqldata.php to get info from db require -> imagegd.php takes mysql data and var from template.php and resizes image then outputs to browser(no save) Q1. a)does template.php have to wait for mysqldata.php to be fully rendered/computed before moving on to imagegd.php or b)does imagegd.php get called immediately and has to wait for mysqldata.php to supply the info needed (i presume the (a) is correct) Q2. once imagedgd.php has been called and an image generated is that image pushed to the browser or is the template.php rendered as html sent to browser and the browser then requests the imagegd.php script and the image is generated. Q3. is there a good way ( i have tried ob_start("ob_gzhandler"); ) to buffer the page and wait for all images but it only seems to work on text/layout rather than graphics/fla etc. thx Art Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/ Share on other sites More sharing options...
vanderlay Posted May 14, 2007 Author Share Posted May 14, 2007 ** BUMP ** anybody? echo!!!!! or is this a silly question? Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/#findComment-253132 Share on other sites More sharing options...
john010117 Posted May 15, 2007 Share Posted May 15, 2007 First of all, please wait at least an hour before bumping. It really annoys those who are trying to help you. We do have lives you know... Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/#findComment-253157 Share on other sites More sharing options...
corbin Posted May 15, 2007 Share Posted May 15, 2007 PHP is processed line by line..... The entire thing is compiled, and then it's executed in the order it was in.... You're basically asking if you did echo "hello"; echo " people"; whether people would be echo'd before hello was done processing if I understand right, and no, it does not work like that (I could be wrong, but I'm fairly sure ;p). If it worked like that, then a SQL query could try to query a lagging DB link or something like that. As for your second question..... PHP cannot output an image and HTML on the same page... Well, it can but it will not display correctly. That would be like if you tried to make a plain HTML page and put an image in it without an <img> tag. Question 3: I've seen parts of what you're trying to do done with javascript, but PHP with buffering does this: Generate page conent Send to browser. If the download speed or what ever other barrier gets in the way, it's the exact same loading as a plain HTML page would be. Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/#findComment-253165 Share on other sites More sharing options...
vanderlay Posted May 15, 2007 Author Share Posted May 15, 2007 thx Corbin, good answer explains things for me very well. Art Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/#findComment-253306 Share on other sites More sharing options...
vanderlay Posted May 15, 2007 Author Share Posted May 15, 2007 to john010117, please check your facts before having a go at some body...i did wait at least an hour before bumping A.M. abbreviation ante meridiem Meaning: being before noon P.M. abbreviation post meridiem Meaning: being after noon Quote Link to comment https://forums.phpfreaks.com/topic/51298-understanding-php-processing-and-page-output-order/#findComment-253308 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.