Main features:
- Open source, free - in public domain, short piece of PHP code
- Antialiased, realistically looking output
- Highly configurable and flexible (uses 2D projection of 3D data)
- Easy to install and use (accessing it as a regular image from HTML)
- Supports 2x2x2, 3x3x3, 4x4x4, 5x5x5, 6x6x6, 7x7x7 cubes and beyond
Introduction
The first version (ugly) was inspired by Lars Vandenberg's PHP imagecube script, but is much shorter. The main advantage is the transparent background. This version vas done just by reverse engineering of the Lars's code to enable to start make a more customized and flexible script.
HTML code used is
<img src="picube.php?fl=xgpxbyxoxybywwyyyyrrrrrrooo" alt="" />
<img src="picube.php?fl=ywywywywybgbgbgbgbrorororor" alt="" />
The second second version uses resampling to enhance the visual quality, but may be slower (who cares, anyway). Now, it looks close to the picture taken from Gilles Roux's site (the left image is the original Gilles's gif).
HTML code used is
<img src="icube.php?fl=orobroooolyllgllgllwlllllll&bg=E6E6E6" alt="" />
I included some additional colors to the standard ones. Background color can be specified - parameter 'bg', value is 6 characters HTML RGB code (default is FFFFFF = white). You can see on the last picture that the size is also configurable (default is 100x100).
HTML code used is
<img src="icube.php?fl=xgpxbyxoxybywwyyyyrrrrrrooo" alt="" />
<img src="icube.php?fl=robgwyldxkcpmrobgwyldxkcpmr&bg=1080D0" alt="" />
<img src="icube.php?fl=ywywywywybgbgbgbgbrorororor&bg=D0D0D0&size=50" alt="" />
You can visualize different view angles that are implemented by mirroring the image internally in the script - parameter 'm', values 'x', 'y', or 'xy'. (Surprised by 4x4x4? See bellow.)
HTML <img> src parameters used are
icube.php?n=4&fl=xpxyowrrbygywygowbgwyowrrxyorgybrrwyrwybwyowbgwb
icube.php?n=4&fl=xpxyowrrbygywygowbgwyowrrxyorgybrrwyrwybwyowbgwb&m=x
icube.php?n=4&fl=xpxyowrrbygywygowbgwyowrrxyorgybrrwyrwybwyowbgwb&m=y
icube.php?n=4&fl=xpxyowrrbygywygowbgwyowrrxyorgybrrwyrwybwyowbgwb&m=xy
There are three output formats available: png, gif (appears dithered), and jpeg or jpg (blures and distorts image...).
HTML <img> src parameters used are
icube.php?f=png&fl=ywywywywybgbgbgbgbrorororor&bg=C0C0C0
icube.php?f=gif&fl=ywywywywybgbgbgbgbrorororor&bg=C0C0C0
icube.php?f=jpg&fl=ywywywywybgbgbgbgbrorororor&bg=C0C0C0
There is a new functionality available that enables you to render any NxNxN cube. There is a new parameter 'n' set to cube size (2 for 2x2x2, 4 for 4x4x4, ... default value is 3). The 'fl' parameter takes 3 x N x N characters in this case (48 for 4x4x4, 75 for 5x5x5, ...). (I am sorry, if you got offended by the imposible color scheme, but I generated the stickers randomly to save time.)
HTML <img> src parameters used are
icube.php?n=4&fl=xpxyowrrbygywygowbgwyowrrxyorgybrrwyrwybwyowbgwb
icube.php?n=5&fl=yorgbwgyowbryo...cut...gybrrwyyowbw
icube.php?n=6&fl=rowrwygwrbwygo...cut...yorgybrrwyyo
For those that are even more concerned about the visual appearance of the cube there is 'b' parameter specifying border width of the stickers. Values should be in a range from 0 to about 200 (default is 25). There is also 'd' parameter to specify how far above the cube are the stickers. Values should fall between 0 and 100 (default is 5).
HTML <img> src parameters used are
icube.php?fl=ywywywywybgbgbgbgbrorororor&b=0&d=0
icube.php?fl=ywywywywybgbgbgbgbrorororor&b=200
icube.php?n=4&fl=ywywwywyywywwywybgbggbgbbgbggbgbrorororororororo&b=10
icube.php?fl=ywywywywybgbgbgbgbrorororor&b=100&d=100
icube.php?fl=ywywywywybgbgbgbgbrorororor&d=200
Look at the source text of this page to see how easy is to draw a nice cube now.
There is an imagecube parameter generator developed by Joël van Noort you can use to simplify producing the image arguments.
Substitution of Lars Vandenberg's script imagecube.php and imagerevenge.php
To make switching between Lars's and the presented 'standard' script easier the script supports 'stickers' and 'size' parameters.
The following appendix shows using this script for the same situations shown at: Lars's imagecube page.
Note: Lars's script has the advantage of transparent background. Use his script if you cannot live without it (or the first version of the presented script).
Examples of Replacing imagecube.php by icube.php
Example 1: Illustrating the CFOP system
Scrambled cube |
Cross solved |
F2L solved |
F2L + OLL solved |
Cube solved |
Example 2: Various sizes
50x50 pixels |
75x75 pixels |
100x100 pixels |
150x150 pixels |
200x200 pixels |
Example 3: Ignoring parts of the cube
Only showing cross + pair |
Insert final pair and orient edges |
Only showing corners |
Examples of Replacing imagerevenge.php by icube.php&n=4
Example 1: Illustrating the centres first system
Scrambled cube |
Centres solved |
Edge pairs solved |
3x3x3 step solved |
Example 2: Various sizes
50x50 pixels |
75x75 pixels |
100x100 pixels |
150x150 pixels |
200x200 pixels |
Example 3: Ignoring parts of the cube
Only showing centres |
Ignoring corners |
Only showing corners |