Do any of you know how to resize the image via PHP4?

I want to run my own photo gallery program, but I need the codes to create thumbnails (smaller file size and dimensions).

Thanks in advance!