-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 16 additions & 4 deletions
20
hrms/src/main/java/kodlamaio/hrms/business/concretes/ImageForCVManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
hrms/src/main/java/kodlamaio/hrms/core/utilities/imageUpload/ImageUploadManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package kodlamaio.hrms.core.utilities.imageUpload; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import com.cloudinary.Cloudinary; | ||
import com.cloudinary.utils.ObjectUtils; | ||
|
||
import kodlamaio.hrms.core.utilities.results.DataResult; | ||
import kodlamaio.hrms.core.utilities.results.ErrorDataResult; | ||
import kodlamaio.hrms.core.utilities.results.SuccessDataResult; | ||
|
||
@Service | ||
public class ImageUploadManager implements ImageUploadService{ | ||
|
||
private Cloudinary cloudinary; | ||
|
||
public ImageUploadManager() { | ||
|
||
this.cloudinary = new Cloudinary(ObjectUtils.asMap( | ||
"cloud_name", "dayx2sam5", | ||
"api_key", "699443261618643", | ||
"api_secret", "LaC_8aO4_p-vseLXfpOJGuC-sjI")); | ||
} | ||
|
||
@Override | ||
public DataResult<Map> uploadImageFile(MultipartFile imageFile) { | ||
try { | ||
@SuppressWarnings("unchecked") | ||
Map<String, String> resultMap =(Map<String, String>) cloudinary.uploader().upload(imageFile.getBytes(), ObjectUtils.emptyMap()); | ||
return new SuccessDataResult<Map>(resultMap); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
|
||
} | ||
return new ErrorDataResult<Map>(); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
hrms/src/main/java/kodlamaio/hrms/core/utilities/imageUpload/ImageUploadService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package kodlamaio.hrms.core.utilities.imageUpload; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import kodlamaio.hrms.core.utilities.results.DataResult; | ||
|
||
public interface ImageUploadService { | ||
|
||
DataResult<Map> uploadImageFile(MultipartFile imageFile); | ||
} |