public function uploadImageForUser($file, $id)
 {
     $user = $this->userDao->get($id);
     ResultHelper::whenEmpty($user, AppLabelUtil::$ERROR_USER_NOT_FOUND, HttpStatusCode::badRequest());
     $imageBuilder = new ImageBuilder($file["files"]["name"], $file["files"]["tmp_name"]);
     $newFileName = $imageBuilder->create(WEB . "/assets/user/" . $user->getUsername() . "/image/", 400, 400);
     ResultHelper::whenEmpty($newFileName, AppLabelUtil::$ERROR_APP_INTERNAL, HttpStatusCode::internalServerError());
     $user->setPicture($newFileName);
     return $this->userDao->update($user);
 }
 private function uploadImage($file, $componentType = "misc")
 {
     $imageBuilder = new ImageBuilder($file["files"]["name"], $file["files"]["tmp_name"]);
     return $imageBuilder->create(WEB . "/assets/component/" . $componentType . "/");
 }
        $fname = 'ImageBuilder::addMissingImage';
        $size = filesize($fullpath);
        $info = $this->imageInfo($filename);
        $timestamp = $this->dbw->timestamp(filemtime($fullpath));
        global $wgContLang;
        $altname = $wgContLang->checkTitleEncoding($filename);
        if ($altname != $filename) {
            if ($this->dryrun) {
                $filename = $altname;
                $this->log("Estimating transcoding... {$altname}");
            } else {
                $filename = $this->renameFile($filename);
            }
        }
        if ($filename == '') {
            $this->log("Empty filename for {$fullpath}");
            return;
        }
        $fields = array('img_name' => $filename, 'img_size' => $size, 'img_width' => $info['width'], 'img_height' => $info['height'], 'img_metadata' => '', 'img_bits' => $info['bits'], 'img_media_type' => $info['media'], 'img_major_mime' => $info['major'], 'img_minor_mime' => $info['minor'], 'img_description' => '(recovered file, missing upload log entry)', 'img_user' => 0, 'img_user_text' => 'Conversion script', 'img_timestamp' => $timestamp);
        if (!$this->dryrun) {
            $this->dbw->insert('image', $fields, $fname);
        }
        $this->log($fullpath);
    }
}
$builder = new ImageBuilder(isset($options['dry-run']));
if (isset($options['missing'])) {
    $builder->crawlMissing();
} else {
    $builder->build();
}