/** * @param $id * @param EstateAdBindingModel $estate */ public function addEstateAdditionalImages($id, EstateAdBindingModel $estate) { foreach ($estate->images as $image) { $imageName = $this->saveFile($image, EstateController::IMAGE_DIR . DIRECTORY_SEPARATOR); if (!empty($imageName)) { $imageId = $this->image->add($imageName); $this->image->addImageToEstate($id, $imageId); if ($this->validateImageDimensions(EstateController::IMAGE_DIR . DIRECTORY_SEPARATOR . $imageName, EstateController::IMAGE_MAX_WIDTH_WITHOUT_RESIZE, EstateController::IMAGE_MAX_HEIGHT_WITHOUT_RESIZE)) { $this->createImageThumbnail($imageName, EstateController::IMAGE_THUMBNAIL_WIDTH, EstateController::IMAGE_THUMBNAIL_HEIGHT, EstateController::IMAGE_THUMBNAIL_PREFIX, EstateController::IMAGE_DIR); } } } }