The following code works on my laptop but doesn\'t work on remote server:
Changed the line:
imagecopy($image, $mask, 0, 0, 0, 0, $newwidth, $newheight);
to:
imagecopymerge($image, $mask, 0, 0, 0, 0, $newwidth, $newheight,100);