I'd be happy to help, but this isn't a place to request free work.
The logic behind it is pretty simple:
- Gather a listing of all pictures in the folder (a simple glob or using the scandir to get a list)
- Create a canvas that is 500x500 pixels in GD or ImageMagick
- Iterate through this list, and resize them to the required size (50x50)
- Add the newly resized image to your canvas at 50<iteration number>, 50(<iteration number>/10)
Some example code, which I have not tested and is only meant to show an example, would be something like:
<?php
// Get list of all JPG files in a particular path
$files = glob('/path/to/my/folder/*.jpg');
// Create a canvas for the collage
$canvas = imagecreate(500, 500);
// Hold a row counter
$row=0;
// Start iterating over files that will make up the collage
for ($i=0; $i<count($files); $i++) {
// If $i isn't 0, and is divisible by 10, increment the row counter
if ($i>0 && $i%10 == 0) { $row++; }
$original = imagecreatefromjpeg($files[$i]);
// Option A: Scale image yourself first and add to collage
$scaled = imagescale($original, 50, 50);
imagecopymerge($canvas, $scaled, 50*$i, 50*$row, 0, 0, 50, 50, 100);
// Option B: Copy and scale at the same time
list($width, $height) = getimagesize($files[$i]);
imagecopyresampled($canvas, $original, 50*$i, 50*$row, 0, 0, 50, 50, $width, $height);
// Free up memory
imagedestroy($original);
}
// output the image
header('Content-Type: image/jpeg');
imagejpeg($canvas);
// Free up memory
imagedestroy($canvas);
Hope that helps you.