Added function imagepalettecopy to ext_gd

Closes #3338