[CODE] Random image generator for php (plus caching and gzip)


New member
Last year I was studying basic database in my college and in the last assignment I had to develop a random image generator (short long history: I had to generate some profile pics for placeholder users to make the database huge). I made some changes before posting here, in the old version it would only draw circles inside the picture and in this it can generate circles and regular polygons with 3 or more sides. Also, I added more configuration variables and released under The Unlicense (means full public domain, so you can copy, edit, compress, expand, create, etc) on github.

It's fully commented for you and available on https://github.com/marco-xd/PHP-Random-Image.

If you want to understand more, you can PM me anytime or post here. Also, I recommend reading the following links:

You can pass the arguments via GET or let the code use random values. It accepts the following arguments:
  • seed: Random seed (string)
  • width: Image width
  • height: Image height
  • antialias: Image antialiasing (GD circles have a lot of aliasing)

These arguments are limited on the server-side so you cannot enter a huge value of width and use all of the computer memory.

Some results are attached below.


  • image__width.1000_height.100_antialias.2_seed.gigarank.png
    59.1 KB · Views: 1
  • image__width.1000_height.200_antialias.2.png
    83.6 KB · Views: 1
  • image__width.500_height.100_antialias.3.png
    42.7 KB · Views: 1
  • image__width.500_height.500_antialias.2.png
    96.1 KB · Views: 1


New member
That reminds me of the book AAron's Code : Meta-Art, Artificial Intelligence, and the Work of Harold Cohen by Pamela McCorduck. Basically it tells the story of artist Harold Cohen who developed software to autonomously produce drawings.