Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3947

Order/Timing of Execution of PHP

From "Jeff Gaines" <jgaines_newsid@yahoo.co.uk>
Newsgroups comp.lang.php
Subject Order/Timing of Execution of PHP
Date 2011-11-27 12:01 +0000
Message-ID <xn0hm3pyv2tnoe7000@news.individual.net> (permalink)

Show all headers | View raw


A comment in this group made me look at a website again. It has a couple 
of 'photo albums on it and when the visitor clicks on either of the album 
pages it uses 
imagecreatefromjpeg/imagecreatetruecolor/imagecopyresized/imagejpeg to 
create thumbnails from the full sized images with links to them.

I decided that I should create the thumbnails locally and then upload them 
to save visitors wondering why there was a delay when visiting the pages. 
I use the following code:

<div id="content">
<article>
<section>
<br />
<br />
<p>
Select Album To Create
<br />
</p>

<hr>
     <a href="?run=all">All</a>
     <br>
     <a href="?run=album">Album Only</a>
     <br>
     <a href="?run=george">George\'s Album Only</a>
     <br />
     <br />

     <?php

         if (isset($_GET['run']))
           $linkchoice=$_GET['run'];
         else $linkchoice='';

         switch($linkchoice)
           {
             case 'album' :
               echo('<b>Creating Thumbnails For Album...</b>');
               echo('<br /><br />');
               createalbum();
               echo ('Album Thumbs Created');
               echo ('<br /><br />');
               break;

             case 'george' :
               echo('<b>Creating Thumbnails For George\'s Album...</b>');
               echo ('<br /><br />');
               creategeorge();
               echo ('George\'s Thumbs Created');
               echo ('<br /><br />');
               break;
           }
     ?>

</section>
</article>
</div>

What this does is show links for 2 options and then re-post the page.

It works but doesn't echo 'Creating Thumbnails' etc. until it has called 
the function and returned from it.

Is there a way to get these statements echoed before it calls the function 
or is this just the way php/server side functions work, in which case 
perhaps I should use Java?

-- 
Jeff Gaines Wiltshire UK
Indecision is the key to flexibility

Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Order/Timing of Execution of PHP "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-11-27 12:01 +0000
  Re: Order/Timing of Execution of PHP Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-27 14:14 +0000
    Re: Order/Timing of Execution of PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-28 01:53 +0100
  Re: Order/Timing of Execution of PHP Jerry Stuckle <jstucklex@attglobal.net> - 2011-11-27 09:43 -0500
    Re: Order/Timing of Execution of PHP "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-11-28 11:07 +0000

csiph-web