See φ in action
The above image is generated using <img src="./stuff.php?bgc=red&fgc=blue" alt="a image with a red background and blue text reading '50 x 50'">.
Options
There are five different options. All are optional.
- x width, see below for more info.
- y height, see below for more info.
- txt the image text, "x x y" by default (where the first x, and the y, are replaced by the numbers)
- bgc background colour, gray by default, see below for further info.
- fgc foreground colour, black by default, see below for further info.
sizes
If either x or y is blank, than it is given the same value as the other. If both are blank, then it defaults to 50 by 50. If either value is less than 10, the program will round up to 10. If either value is more than 500, it will round down to 500.
Colours
Colour names are: Black = "000000" Green = "008000" Silver = "C0C0C0" Lime = "00FF00" Gray = "808080" Olive = "808000" White = "FFFFFF" Yellow = "FFFF00" Maroon = "800000" Navy = "000080" Red = "FF0000" Blue = "0000FF" Purple = "800080" Teal = "008080" Fuchsia = "FF00FF" Aqua = "00FFFF" (from W3C CSS standard)
As well as naming colours, you can use a six char hexadecimal number (such as given above). If you don't use a color name, the following transformation may happen to your string:
First striped of chars not a valid hexadecimal numeral (0-9 a-f). The result is then made exactly six chars, either by padding with zeros (0) or stripping excess chars.
Other programs
So, I originally got the idea of coding this after seeing http://placehold.it/ I thought "how hard could that be?" After messing around over a few nights and a bit (maybe 20 minutes a night), I came up with version 0.1. I then thought, seeing as it's so easy, there must be other programs that do the same thing. Right? A quick search turns up a number of options, including: http://dummyimage.com/ which has code available, and a list of links to more programs. The author of dummyimage.com has a blog post which lists many other dummy/place holder image generators (not this one yet though).
Future
There are certainly ways to make this program better, such as the text position and size (and font), outputting more image formats or caching images. However, I'll probably not implement any of these, as I've proved to myself that it is possible to write the program in a short amount of time.
download
license
Copyright 2011 by Michael Harris, http://next-nexus.info/harrismw This program is free software. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Site & page info (footer)
Mostly handcrafted by Michael, this website was designed to standards, with the highest quality in mind, and in result. The code and content is freely available.
This page is located at http://next-nexus.info/webdev/minor/phi/ and was last modified on 2023-08-31.