SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP code to display some kind of busy image/icon until a process is complete?

    Hi All,

    I am having an exec() function in my code which invokes a shell script to convert an mp3 file into flv format.
    Now this conversion takes some time say around 4-5 minutes if the file is large. During this time I want to show some kind of busy icon with message asking the user to be patient. How to write in the code?

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you going to upload the mp3 files from some html form itself or you want to convert it from somewhere else that is already stored in a path in the server? Since I do not know directly uploading files via AJAX, what I would do is; first upload the file to somewhere in the server then run the converting script via AJAX so that we can show that working/loading image.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Molde, Norway
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Adamsom View Post
    Hi All,
    I am having an exec() function in my code which invokes a shell script to convert an mp3 file into flv format.
    Now this conversion takes some time say around 4-5 minutes if the file is large. During this time I want to show some kind of busy icon with message asking the user to be patient. How to write in the code?
    The exec function does not return any results until completion, so retreiving any live status is not possible from that.

    The easy way would have to be calculating the time it will take to convert the mp3 file according to filesize or play length (I would think filesize is best to use). Then make a javascript that show some kind of countdown or calculated time left. That is not a good way, but the easiest way.

    The calculated time will change with server load and miscalculations. I recommend adding some extra time to the calculations to make user experience better.
    Software developer at ADCom Data
    My blog for dumping information

  4. #4
    SitePoint Member
    Join Date
    Dec 2009
    Location
    Plovdiv, Bulgaria
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could create a file containing the temporary conversion progress results, however it must have unique name. This make it much more difficult to manipulate the data, to perform conversion, etc... Therefore, I think you do not need 100% precise results. You could see the average time it takes to convert 100 kilobytes, or even 1 megabyte if you want and according to that time, as it was already said, you can estimate what time it would take to finish the conversion process.

  5. #5
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,077
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rajug View Post
    Are you going to upload the mp3 files from some html form itself or you want to convert it from somewhere else that is already stored in a path in the server? Since I do not know directly uploading files via AJAX, what I would do is; first upload the file to somewhere in the server then run the converting script via AJAX so that we can show that working/loading image.
    AJAX would be my thought also, have a % complete which PHP would update, the AJAX would pick up on the update to the % complete and change whatever your using to denote 'operation in progress' to match.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •