/**
  * @param array $conf
  * @param string $ext
  * @param int $categoryType
  * @param int $categorySubType
  * @param string $path
  * @param string $mediaType
  * @param array $metaInputs
  * @return \App\Models\Base|null
  */
 private function uploadImage($conf, $ext, $categoryType, $categorySubType, $path, $mediaType, $metaInputs)
 {
     $dstPath = $path . '.converted';
     $format = array_get($conf, 'format', 'jpeg');
     $size = $this->imageService->convert($path, $dstPath, $format, array_get($conf, 'size'));
     if (!file_exists($dstPath)) {
         return null;
     }
     $fileSize = filesize($path);
     $bucket = $this->decideBucket($conf['buckets']);
     $region = array_get($conf, 'region', 'ap-northeast-1');
     $seed = array_get($conf, 'seed_prefix', '') . time() . rand();
     $key = $this->generateFileName($seed, null, $ext);
     $url = $this->uploadToS3($dstPath, $region, $bucket, $key, 'image/' . $format);
     $image = $this->imageRepository->create(['url' => $url, 'title' => array_get($metaInputs, 'title', ''), 'file_category' => $categoryType, 'file_subcategory' => $categorySubType, 'article_id' => array_get($metaInputs, 'articleId', ''), 's3_key' => $key, 's3_bucket' => $bucket, 's3_region' => $region, 's3_extension' => $ext, 'media_type' => $mediaType, 'format' => $mediaType, 'file_size' => $fileSize, 'width' => array_get($size, 'width', 0), 'height' => array_get($size, 'height', 0), 'is_enabled' => true]);
     foreach (array_get($conf, 'thumbnails', []) as $thumbnail) {
         $this->imageService->convert($path, $dstPath, $format, $thumbnail);
         $thumbnailKey = $this->getThumbnailKeyFromKey($key, $thumbnail);
         $this->uploadToS3($dstPath, $region, $bucket, $thumbnailKey, 'image/' . $format);
     }
     return $image;
 }