/**
  * @param $id
  * @param $imageName
  * @param $type
  * @return productGalleryModel
  */
 public function addProductImage($id, $imageName, $type)
 {
     $productGallery = new productGalleryModel();
     $productModel = new productModel();
     $prefixPath = '/images/product/';
     $product = $productModel->getProductById($id, false);
     $thumbPath = '';
     $newThumbPath = '';
     $imageNameFinal = explode('.', $imageName);
     $typeImage = $imageNameFinal[count($imageNameFinal) - 1];
     if ($type == PRODUCT_IMAGE_TYPE_SLIDE) {
         $newThumbPath = $prefixPath . $product->name . ' thumb ' . crc32($imageName) . '.' . $typeImage;
         $thumbPath = str_replace(PATH_PUBLIC, '', $this->createThumbnail(PATH_PUBLIC . $imageName, 80, 80, [255, 255, 255]));
         $this->uploadToS3($thumbPath, $newThumbPath);
     }
     $newImageName = $prefixPath . $product->name . ' ' . crc32($imageName) . '.' . $typeImage;
     $return = $productGallery->addProductImage($id, $newImageName, $newThumbPath, $type);
     $this->uploadToS3($imageName, $newImageName);
     return $return;
 }