PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You're looking for [php_man]imagecopyresampled[/php_man] ideally, or [php_man]imagecopyresized[/php_man] if the other one isn't supported in your version of PHP.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.