Image upload handler with random filename generator and postprocessing
Extract Code to Function and avoid goto

First of all, I would extract this code to it's own function, and then I would use a while loop looking something like this:

private function getUnusedRandomFileName($extention) {
    $name = $this-&gt;random_name() . $extention;

    while(file_exists($this-&gt;img_path . $name)){
        $name = $this-&gt;random_name() . $extention;
    }

    $return name;
}


To avoid the two duplicate lines, you could also use do-while:

private function getUnusedRandomFileName($extention) {
    do {
        $name = $this-&gt;random_name() . $ext;
    } while (file_exists($this-&gt;img_path . $name)); 
    return $name;
}


Or, since you now have a function, you could return:

private function getUnusedRandomFileName($extention) {
    while(true){
        $name = $this-&gt;random_name() . $ext;
        if(!file_exists($this-&gt;img_path . $name)){
            return $name;
        }
    }
}


Or use recursion:

private function getUnusedRandomFileName($extention) {
    $name = $this-&gt;random_name() . $extention;
    if (file_exists($this-&gt;img_path . $name)) {
        return getUnusedRandomFileName($extention);
    } else {
        return $name;
    }
}


So there are many methods to solve this without goto. I like the third best, but choose the one you like.

Misc


More functions: in addition to the getUnusedRandomFileName function, I would also add a createThumbnail function, and possibly createImageFrom and writeImageTo, for the first and second switch statement.
Paths: at one point you have $this-&gt;img_path . $name, and at another you have $this-&gt;args['base_url'].'img/'. $name. Do these mean the same thing? Is $this-&gt;img_path the same as img? In that case use it everywhere, otherwise it will cause bugs when changed.
The image type is completely user controlled, so $image_type = $_FILES[$img_name]['type']; will be whatever the user wants it to be; exif_imagetype is also bypassable. So it seems that the in_array($ext,$valid) is currently the only part that prevents attacks. I would add a comment stating this, just in case the code is changed later on.