Пример #1
0
 /**
  * @param $id
  * @param $parentId
  * @param $typeId
  * @param $imageName
  * @return int
  */
 public function updateImage($id, $parentId, $typeId, $imageName)
 {
     $productGalleryService = new productGalleryService();
     $tagModel = new tagModel();
     $tag = $tagModel->getTagRelation($id, $typeId);
     if ($tag->image) {
         $productGalleryService->deleteFromS3($tag->image);
     }
     if ($imageName) {
         $newPath = '/images/tag/kacana_tag_' . $tag->parent_id . '_' . $tag->child_id . '_' . $tag->tag_type_id . '_' . time() . '.jpg';
         $productGalleryService->uploadToS3($imageName, $newPath);
         $imageName = $newPath;
     }
     $tag = $tagModel->updateImage($id, $parentId, $typeId, $imageName);
     return $tag;
 }