+ Reply to Thread
Results 1 to 8 of 8

Thread: How to display a "wait" page while php busy ?

  1. #1
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Question How to display a "wait" page while php busy ?

    Hello

    While php works on an image (upload with transformation: imagecreatetruecolor, imagecreatefromjpeg, imagecopyresample, imagejpeg...) I would like to display a page that makes the client understand it's working, and there is some seconds of wait. And naturely, I want this page disappears when the imagedestroy is ended.

    How can I do that ? I've tried with javascript DOM to make a layer visible or not, but that is made only when all is finished, not while the php code is running !

    Thank for your answers.

  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: How to display a "wait" page while php busy ?

    I believe AJAX would help you find a solution. But please not I have no experience with AJAX.

    http://www.sencha.com/deploy/dev/exa...gress-bar.html
    http://www.ajaxload.info/
    http://www.astahost.com/info.php/Aja...ar_t17609.html

  3. #3
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: How to display a "wait" page while php busy ?

    jQuery!

    http://jqueryui.com/

    It'll be your best friend.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  4. #4
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: How to display a "wait" page while php busy ?

    Thank you two for the links. But in fact, I was wrong, and probably I do not explain well. I wanted only show one of my page while server works. I had an error in my script (the "id" in the object tag html was not which I used in the Javascript !) I've find it, it works well now.

    Thanks again for your answers.

  5. #5
    learning_brain is offline x10 Sophmore learning_brain is an unknown quantity at this point
    Join Date
    Apr 2010
    Location
    UK, Midlands
    Posts
    170

    Re: How to display a "wait" page while php busy ?

    There is a simpler php solution that I use to see if the page is processing as it should.

    flush() and ob_flush().

    Each time this function is called, it forces the previous content to output to display.

    If you enter these after each echo or <img>, they will appear on screen as soon as they have been processed and you don't have to wait for the whole page to load.

    Progress meters can work on a similar principal.

    If you go to the crawler page on my site, you'll see it working.

    www.qualityimagesearch.com/bot.php
    Last edited by learning_brain; 07-21-2010 at 06:39 PM.

  6. #6
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: How to display a "wait" page while php busy ?

    OK, learning_brain, that seems to satisfy me. I will test it as soon as possible.

    Thanks.

  7. #7
    deroba's Avatar
    deroba is offline x10Hosting Member deroba is an unknown quantity at this point
    Join Date
    Nov 2009
    Location
    Colombia
    Posts
    10

    Re: How to display a "wait" page while php busy ?

    Yea, use PHP flushing, display an image and when page is fully loaded using JavaScript, make that image source change to the new one.

  8. #8
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: How to display a "wait" page while php busy ?

    You might want to note that use of PHP ob_flush is not really the ideal solution in terms of server, user and browser friendliness. Basically, if the server is continuously sending data then the browser will never receive the full page contents and has to guess how the tags will be closed and will eternally say that the page is loading, as demonstrated learning_brain's page.
    The ultimate solution to this sort of problem will always be reduced to an AJAX based communication with the server that'll inform the browser when to show the loading image and when to move the user on to the next page.
    The problem that is causes on the browsers end is that the connection to the server is persistent and remains open until the entirety of the page has been transmitted: this means that the server could very easily become clogged with concurrent connections which could then reach the limit imposed by either Apache or any other software.
    These are things you should keep in mind when you start designing this.

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: 05-08-2010, 03:17 AM
  2. Replies: 1
    Last Post: 01-17-2010, 09:16 PM
  3. Replies: 7
    Last Post: 10-01-2009, 05:16 PM
  4. Replies: 3
    Last Post: 01-21-2008, 02:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers