Automatic Magazine Layout

by Harvey Kane

35 Reader Comments

Back to the Article
  1. I love the script! I was looking for an interesting way to put some photos on my site. I’ve modified the script slightly so that it picks images at random from a directory, and I modified image.php to use caching. I like it so much I’ve put it on the “home page”:http://www.ouafc.com

    Copy & paste the code below to embed this comment.
  2. I’ve found this very useful and i’d certainly never in a million years (with my single gcse in maths )have come up with the algebra for this myself. It’d be handy if it could be reversed so that one could specify the max height rather than the width, or possiblly both. I think the former could be achieved very easily if only i could get my head round the maths. it’s be a simple matter of reversing the formula, right?

    Should have paid more attention in school. Algebra IS usefull, who knew it?

    Copy & paste the code below to embed this comment.
  3. This script is great! So great that my own CMS had to have one… only it’s an ASP cms, and ASP 3.0 doesn’t have facilities to read/write image dimensions! Anyway, I collected a couple of scripts from third-parties, and here it is: a fully working magazine layout in Classic ASP (ASP 3.0)!, under the form of a simple ASP class. It doesn’t include any “resize image” script, but this can easily be done with an external resize.PHP or .ASPX script.

    Copy & paste the code below to embed this comment.
  4. Outstanding work; however, I wanted to suggest an even more general solution, capable of arranging arbitrarily many images, using recursion.  Any possible arrangement can be derived from two basic layouts: vertical (v) and horizontal (h).  For example, the layout you call “3a” could be achieved with h(h(i1, i2), i3). Similarly, “3b” is h(v(i1, i2), i3).  “4a” could be derived a number of ways, one of them being h(h(i1, i2), h(i3, i4)).

    The algorithm would randomly divide the set of images into smaller and smaller subsets, then work its way back up, applying one of the two layouts to the intermediate results.  At each level, it could either choose the layout randomly, resulting in some interesting patterns, or using some aesthetic rules based on the portrait/landscape orientation of the subresults.

    Copy & paste the code below to embed this comment.
  5. This is a wonderful, insightful and uplifting case of a revealing infrastructure Automatic Magazine Layout implementation. Keep up these useful pieces. Your help would be appreciated.
    Thanks.

    Copy & paste the code below to embed this comment.