im getting a bunch on errors on my wallpaper script

i think i did something bad on it and i have no idea how to proceed in fixing it. im new to php and i dont have much programming expirience. it was working find but then i read an article about how you can add a certain feature into your GD library to make your images better but in the process i changed some variables in the program and i think i screwed up the whole script in return.

i need you help, how can i fix these errors please