|
|
Lars Vandenbergh's CubeZone
Speedcubing taken one step further
|
ImageRevenge
A PHP script for generating static 3D views of the 4x4x4 Rubik's Cube
ImageRevenge is a PHP script I wrote for generating static images of the 4x4x4 Rubik's Cube. It can be used for building websites explaining methods or for illustrating certain move sequences. It is inspired by ImageCube, which serves the same purpose for the 3x3x3 Rubik's Cube. The main advantages of it are that:
- It generates a standard PNG image with a transparent background that can be viewed in any web browser. It doesn't use Java, JavaScript or any type of client side scripting.
- You can set up cases on a cube very easily. The examples below were all made in a matter of seconds. It's just a matter of entering the colors of the stickers.
- It's very light-weight since it's only a PNG image that is generated. A lot of web sites use 3D Java cubes which look nice and are very useful but that are also quite demanding in terms of page load time and computing power. For situations where having a complete 3D view isn't necessary, this script gives you a good alternative.
Examples
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 |
How to use it
The images above are all generated by imagerevenge.php. This script accepts two input paramters:
- stickers: this is a 48 character string describing the stickers of the visible part of the cube. It will first describe the U face, then the F face and finally the R face. The stickers are described in "reading order", which means from the top left to the bottom right as you look at it. The symbols used are:
- r: for red
- o: for orange
- g: for green
- b: for blue
- w: for white
- y: for yellow
- x: for grey
-
size: this is the size (width and height) of the image in pixels. If you don't include this parameter, the script will just take 200 pixels as the size.
So to generate a cube with the centres solved, like the one shown above, one could use:
<img src="http://qblog.be/imagerevenge/imagerevenge.php?stickers=obrryyygryyboboobybwgggwgggroowrgwwbgrrbwrrwgogg&size=150">
For more examples you can check out the source code of this HTML page. You can also use this direct link to the ImageRevenge script and play around with the parameters to see what effect it has.
Source code
- Soure code in text format: This is the original PHP code of ImageRevenge. If your want to use ImageRevenge on your website, feel free to do so. If your web server supports PHP and you want to make extensive use of my script, I advice you to copy the contents of this text file in a php-file and link your images to it. Keep in mind that this PHP script uses the GD image library, so you will have to check if your web server supports it and has it enabled.