I have created an image by copying a number of images into a new one. In the last step of my program, I am trying to export this file into a folder.
The code is as
$export is going to be a GD image handle. It is NOT something you can simply dump out to a file and expect to get a JPG or PNG image..
For that, you should be doing
imagepng($export, "../pidjin/$bits etc...");
which will create the .PNG file for you.