Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 6th, 2012  |  syntax: None  |  size: 0.55 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Montage or Collage with GD Library
  2. $montage_image = imagecreatetruecolor(100, 100);
  3. $x_index = 0;
  4. $y_index = 0;
  5. foreach($array_with_100_10x10_gif_urls as $gif_image_url) {
  6.     $current_image = imagecreategif($gif_image_url);
  7.     imagecopy($montage_image, $current_image, $x_index * 10, $y_index * 10, 0, 0, 10, 10);
  8.     imagedestroy($current_image);
  9.     $x_index++;
  10.     if ($x_index > 9) {
  11.         $x_index = 0;
  12.         $y_index++;
  13.     }
  14. }
  15. // place code for saving the montage image as a file or outputting to teh browser here.
  16. imagedestroy($montage_image);