If you really need a single image, use the gd image library to create a single image and use an image map to make the small images clickable. You will need to save the coordinate of smaller images to be able to create an image map.
Here is a question that will give a clue how to do that:
Merge two PNG images with PHP GD library
In your case, you need to allocate a big image, where all smaller images will fit and put them into the right position. Then save the output image.
If you don't want a single image you can use CSS Grid layout to make them look like a single image.