Search code examples
phpprogress-barimagick

How to monitor progress of conversion, PDF to JPG with Imagick?


I am using PHP exec() for -convert Image Magick command, and i want to convert more than one page.

Given that it may take a few minutes, I need some kind of progress bar in order to monitor conversion.

Any ideas how I could done this?


Solution

  • well you can not really track the progress of a single conversion. but you could for exmaple do something like the following when you want to convert multiple documents:

    • the number of pages = 100%
    • current page number / number of pages * 100 = progress in percent

    so after each processed page you can update the progress. you can write the info in a file or in a database (linked to the user session for a multi-user software) and poll for the status with an ajax reqeust to a php script which reads this file/db.