I dont know what its relating to but the codes saying that it cant find the $buffer variable. It could be something to do with the image type that your importing??