The changes:
- 1 regular expression performed, instead of 2 in the best case, and 6 in the worst case.
file_get_contents
instead ofimplode()
-ing afile()
- A simple
switch()
construct instead of a chain ofif/elseif
s with regexes - Optimized the order of the switch cases by sorting them by how likely they are to come up
src
of an img
tag, instead of having to include
the script.I found that to be a fabulous idea, so after downloading Xcode Tools to compile GD to test it out, I implemented that change in my new version of the script. So:
Terror.php, Include Version
- To be included using a PHP
include()
- Runs on a server with only a PHP installation
- May be slightly faster
- To be referenced from an HTML
img
tag - Runs on a server with PHP and the GD image library installed
- Much easier to reference, especially from outside
- Download the script of your choice
- Upload it to the desired location on your PHP-compatible server. Remember, the Image Version requires the GD library installed on your server
- In the same directory, upload PNG format images:
- severe.png
- high.png
- elevated.png
- guarded.png
- low.png
- (Image Version only) error.png
Include Version:
<?php include("terror.php"); ?>
Image Version:
<img src="terror.php">
As the comments in the scripts say, if you use the script on your site, please email me and let me know; my email address is in the comments.
In the near future, I may be posting a few image sets for use with these scripts, since I see that Mivox is a fan of the (incomplete) Dragon Tales set.
1 comment:
haha! Just found this post ... thanks for the reverse attribution. ;-)
Post a Comment