PHP Kemu Gradiented Progress Renderer v 1.0This is main documentation file for Kemu Gradiented Progress Renderer v 1.0.IntroductionThis is advanced progress bar renderer for PHP. It renders some nice-looking gradiented progress bars into PNG.For example this: is 100x11 sized dynamically rendered progress bar.SamplesHere are few samples of what "PHP Kemu Gradiented Progress Renderer" renders:No textThe "badGood" skin, size 100x11 pixels, rendered 11 times with progress values 0%, 10%, 20%, ..., 100% without of text:![]() Default textThe "badGood" skin, size 100x11 pixels, rendered 11 times with progress values 0%, 10%, 20%, ..., 100% with the default text:![]() SkinsPredefined skins dump #1:![]() Predefined skins dump #2: ![]() Predefined skins dump #3: ![]() Full skin charts (big pictures !) here: base skins, white skins, Defining width and custom textThe "badGood" skin, defining horizontal size (height is constant: 11px) and some custom text:![]() Notice how the text is auto-aligned in the progress bar. Defining border sizeThe "badGood" skin, defining different border size:![]() Defining heightThe "badGood" skin, defining different height:![]() DescriptionRendered progress bar consists of border, the progress bar itself and some aligned text - however this may vary for different skins.Rendering is based on configuration provided to the rendering module by a calling PHP script. Configuration includes size (width and height) of an image, the name of the skin, border size, progress value, text to display etc. Detailed description of usage is provided in examples section and in source code. DependenciesGD: PHP with GD library support is needed (99% you have it - it's common on 99% of servers).k_cache: Image rendering in PHP takes some precious server CPU time, so caching progress bar images is supported through included PHP Kemu Linear Cache (k_cache) module. k_log: Rendering needs some logging/debugging, so the default k_log API is supported inside renderer. You can attach "PHP Log2Files Advanced Logger" as the logger. Also some dummy logger implementation ("k_log_dummyFileWriter.php") is available in the package. It is used by examples, it can be used for testing, but DO NOT use that in production environment, as this is not locking/threads aware. Read about "PHP Log2Files Advanced Logger" for more info. Features
How toThe usage of this module is so simple, that we decided to show it by few useful examples included in a release pack, instead of providing the "API-like" documentation.There is no "big installing instruction", as there is simply no need to install anything - just unpack. You can even use the examples directly in your productive server - just modify the configuration passed to the renderers in example files and change the file names according to your needs. Of course, if you want to go into details of API calls, the documentation is provided as comments inside PHP files. PackageAfter you unpack the release package into your server, you will find:
Examples - start hereAfter unpacking, run the http://yourserver/examples.php script. This will display the list of examples - you can click on any example to start it.Also there is a "click" for clean up the caches - it just removes all files from "cache" directory. Examples - short wayYou can just use ex02_renderer.php or ex03_renderer.php in your production environment. Of course you may change name of scripts according to your needs :)Do not use directly ex01 nor ex04 scripts, as those are made as feature demos, and do not use cache (running this without cache can simply eat too much of your CPU power). Example #1 - very simple config (non-productive, cache disabled)This example contains 7 different sub-examples. It just calls files: ex01_1renderer.php, ex01_2renderer.php, ex01_3renderer.php, ... in row as images.Each file simply calls K_PROGRESS_GRADIENTED_emitGradient($config) function, giving slightly different config. There is no log usage, there is no cache usage. Those examples are just for experimenting a little bit. You can adjust each of those scripts to experiment with your configs. WARNING: This is example only, never use this code directly on production server. The cache is disabled here !! Example 1.1: - 100 x 20 PNG, skin: badGood, progressValue: 50 - very simple exampleExample 1.2: - 500 x 11 PNG, skin: badGood, progressValue: 90 - example of changing size and progress valueExample 1.3: - 200 x 30 PNG, skin: badGood, progressValue: 120 - example of what happen if you put over-maxed progress value (120%)Example 1.4: - 200 x 30 PNG, skin: badGood, progressValue: 60, borderSize: 5 - example of borderSize changeExample 1.5: - 200 x 30 PNG, skin: badGood, progressValue: 25, progressText: "only 25 percent !" - how to set the custom textExample 1.6: - 200 x 30 PNG, skin: badGood, progressValue: 75, progressText: "" - how to disable textExample 1.7: - 200 x 30 PNG, skin: grass, progressValue: 75 - how to change the skinExample #2 - progress passed by PHP param (productive, cache enabled)This example shows how exactly you may use the K_PROGRESS_GRADIENTED_emitGradient() in your scripts.There is proper log and cache configuration. The script just takes the input parameter "p" (which should be a number) and uses it as progress value. There is also k_cache_id which is an unique id for the k_cache system. Example #3 - progress and skin passed by PHP param (productive, cache enabled)This is very similar to example #2 - it just additionally takes the skin name from PHP params calls.Example #4 - display internal parameters (productive, cache enabled)This example displays internal parameters instead of those passed by param.It displays: - gradient bar of your real HDD usage (disk_total_space() and disk_free_space() functions used), - the fancy clock, made of 3 gradients (hours, minutes, seconds) - just refresh the page to see how it moves, OtherFAQAsk your questions to ss@ke.muLicenseAll copyrights reserved by Kemu Studio, Pietrzak 'yosh' Roman (visit yosh.ke.mu).Source code and documentation available from CodeCanyon |