Reputation: 1
I am trying to create one very large image out of many small ones in PHP using WideImage library.
If the image becomes too big, the server obviously runs out of memory.
Is there anyway to solve this problem by executing this process in batches, or writing directly to disk, for example?
The code looks something like this:
$blank = WideImage::load('../paintings/blank.png'); //this is a blank image file
$new = $blank -> resize($fullWidth,$fullHeight,'fill'); //resize to full image size
for ($x = 0; $x < $fullWidth ; $x = $x + $smallPictureWidth)
{
for ($y = 0; $y < $fullHeight ; $y = $y + $smallPictureHeight)
{
$fileName = //code to get filename based on $x and $y
$img = WideImage::load($fileName);
$new = $new -> merge($img,$x,$y,100);
}
}
$fullImageName = //code to determine file name
$new -> saveToFile($fullImageName);
Thanks!
Upvotes: 0
Views: 307