Search code examples
phpimageimage-processingimage-manipulationphotos

Creating a photo collage image as attached using PHP from several images


How can i create a collage from a large number of images as per below using PHP scripts?

I am also looking at creating different sizes A0, A1, A2 sized images depending on the number of pictures used in the collage.

alt text

Thanks


Solution

  • I suggest using Imagemagick. There are some excellent tutorials on Mikko's blog:

    http://valokuva.org/?cat=1

    Take a look at the Polaroid example, here:

    http://valokuva.org/?p=37

    The Reflection tutorial demonstrates how to create composite images:

    http://valokuva.org/?p=82

    EDIT

    Here's a few more useful links:

    Image Processing (ImageMagick)
    http://php.net/manual/en/book.imagick.php

    Imagick::readImageFile
    http://www.php.net/manual/en/function.imagick-readimagefile.php

    Imagick::rotateImage
    http://www.php.net/manual/en/function.imagick-rotateimage.php

    Imagick::scaleImage
    http://www.php.net/manual/en/function.imagick-scaleimage.php

    PHPro Tutorial
    http://www.phpro.org/tutorials/Imagick.html

    And finally...

    This one is a good starting point:

    Programmed Positioning of Layered Images
    http://www.imagemagick.org/Usage/layers/#example