Upload, rename and modify photo

Hi! I am working on a form now and one of the things that it needs to do is to upload, rename and modify the size of the photo. It’s a sing up form and the upload is the second part. In the first part I got some basic information, put it in a database and stored the id of the subject in the variable $id. Next I want to upload a “logo” image that needs to have the format {$id}_logo.extention and the size needs to be smaller (and I don’t know how small should it be so it can still look good. like 20-30Kb, maybe more if needed, I don’t know).
example: the ferson upload the file myfirmlogo.png, which has a size of 2.3MB. After processing the file needs to be: {$id}_logo.png and the size needs to be like 30Kb

I am new to this and this is how I imagined it. If I’m doing something wrong or I should do it in a different way please let me know. Thanks!