Dynamic Dummy Image Generator
by Russell Heimlich (@kingkool68)Documentation
Size
width x height
- Height is optional, if no height is specified the image will be a square. Example: https://dummyimage.com/300
- Must be the first option in the url
- You can specify one dimension and a ratio and dummyimage will calculate the right value. Example: https://dummyimage.com/640x4:3 or https://dummyimage.com/16:9x1080
Colors
background color / text color
- Colors are represented as hex codes (#ffffff is white)
- Colors always follow the dimensions, https://dummyimage.com/250/ffffff/000000 not https://dummyimage.com/ffffff/250/000000
- The first color is always the background color and the second color is the text color.
- The background color is optional and defaults to gray (#cccccc)
- The text color is optional and defaults to black (#000000)
- There are shortcuts for colors
- 3 digits will be expanded to 6, 09f becomes 0099ff
- 2 digits will be expanded to 6, ef becomes efefef
- 1 digit will be repeated 6 times, c becomes cccccc Note: a single 0 will not work, use 00 instead.
- Standard image sizes are also available. See the complete list.
Image Formats
.gif, .jpg, .png
- Adding an image file extension will render the image in the proper format
- Image format is optional and the default is a gif
- jpg and jpeg are the same
- The image extension can go at the end of any option in the url
Custom Text
&text=Hello+World
- Custom text can be entered using a query string at the very end of the url.
- This is optional, default is the image dimensions (300×250)
- a-z (upper and lowercase), numbers, and most symbols will work just fine.
- Spaces become +
- The font used is from the freely available M+ Font Project
The following characters need to be encoded using the UTF-8 Hex version in order to be rendered properly.
Character | UTF-8 Hex Equivalent |
---|---|
+ | 0x2B |
# | 0x23 |
% | 0x25 |
& | 0x26 |
You'll run into problems trying to manually enter a dimension as text if the numbers use the UTf-8 Hex values above, like &text=400x250. Use a multiplication symbol, × instead (not an x character) to get around this, &text=400×250.
If you need to use other unicode characters, look up their UTF-8 Hex version at http://www.fileformat.info/info/unicode/char/search.htm
Standard Image Sizes
Several standard dimensions are included in dummyimage.com including ad sizes and screen resolution sizes.
Ad Sizes
Keyword | Shortcuts | Dimensions | Regular Expression |
---|---|---|---|
mediumrectangle | medrect | 300×250 | ^(med)\w+(rec\w+) |
squarepopup | sqrpop | 250×250 | ^(s\w+pop) |
verticalrectangle | vertrec | 240×400 | ^(ver)\w+(rec) |
largerectangle | lrgrec | 336×280 | ^(large|lrg)(rec) |
rectangle | rec | 180×150 | ^(rec) |
popunder | pop | 720×300 | ^(pop) |
fullbanner | fullban | 468×60 | ^(f\w+ban) |
halfbanner | halfban | 234×60 | ^(h\w+ban) |
microbar | mibar | 88×31 | ^(m\w+bar) |
button1 | but1 | 120×90 | ^(b\w+1) |
button2 | but2 | 120×60 | ^(b\w+2) |
verticalbanner | vertban | 120×240 | ^(ver\w+ban) |
squarebutton | sqrbut | 125×125 | ^(s\w+but) |
leaderboard | leadbrd | 728×90 | ^(lea\w+rd) |
wideskyscraper | wiskyscrpr | 160×600 | ^(w\w+sk\w+r) |
skyscraper | skyscrpr | 120×600 | ^(sk\w+r) |
halfpage | hpge | 300×600 | ^(h\w+g) |
Screen Standards
Keyword | Dimensions |
---|---|
cga | 320x200 |
qvga | 320x240 |
vga | 640x480 |
wvga | 800x480 |
svga | 800x480 |
wsvga | 1024x600 |
xga | 1024x768 |
wxga | 1280x800 |
wsxga | 1440x900 |
wuxga | 1920x1200 |
wqxga | 2560x1600 |
Video Standards
Keyword | Dimensions |
---|---|
ntsc | 720x480 |
pal | 768x576 |
hd720 | 1280x720 |
hd1080 | 1920x1080 |
Flash Support
Dummyimage.com works with Flash applications.
- Images are served with a specified Content-Length so they can be used in preloaders
- Dummyimage.com uses a crossdomain.xml file
Source Code on GitHub
https://github.com/kingkool68/dummyimage
Dummy Image is written in PHP and distributed freely under a MIT License.
Other Versions
- Fakeimage
- Ruby
- ASP.net Dummy Image
- ASP.net
- Dynamic Dummy Image Generator for Django
- Django/Python
- Random Image Generator
- Dummy Image Generator Expression Engine Plugin
- PHP/Expression Engine
- Dummy Image Bookmarklet
- JavaScript
- Ipsum Image
- Python/Google App Engine
- Textmate Snippet
- Textmate
- Forked Textmate Bundle (Forked version by Aziz Light)
- Textmate
- Dummyimages Drupal Module
- PHP/Drupal
- DIG (Dynamic Image Generator)
- PHP/MODx CMS
- Dummy image
- PHP/Drupal
- [lorem] shortcode
- PHP/WordPress
- Dummy Image ( fr_dummy_image )
- PHP/TYPO3
About Russell Heimlich
I am Russell Heimlich (@kingkool68) and I like to design web pages, blog, and doodle around in JavaScript and PHP.
Contact
Still have questions or suggestions? Contact me.
Комментарии
Отправить комментарий