-
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.
- Exif 모델 만들고 One to One Mapping - Exif 추출 metadata-extractor 추가 - Test 코드 추가 - 파일 업로드시 최대 사이즈 지정
- Loading branch information
1 parent
b667310
commit add2b06
Showing
13 changed files
with
156 additions
and
11 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
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
45 changes: 45 additions & 0 deletions
45
src/main/java/com/ventulus95/ouathjwt/model/exif/Exif.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,45 @@ | ||
package com.ventulus95.ouathjwt.model.exif; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Data | ||
public class Exif { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "exif_id") | ||
private Long id; | ||
|
||
@Column | ||
private String aperture; | ||
|
||
@Column | ||
private String focusLength; | ||
|
||
@Column | ||
private String iso; | ||
|
||
@Column | ||
private String exposureTime; | ||
|
||
@Column | ||
private String Model; | ||
|
||
@Column | ||
private String Maker; | ||
|
||
@Builder | ||
public Exif(String aperture, String focusLength, String iso, String exposureTime, String model, String maker){ | ||
this.aperture = aperture; | ||
this.focusLength = focusLength; | ||
this.iso = iso; | ||
this.exposureTime = exposureTime; | ||
this.Maker = maker; | ||
this.Model = model; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/ventulus95/ouathjwt/model/exif/ExifRepository.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,6 @@ | ||
package com.ventulus95.ouathjwt.model.exif; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ExifRepository extends JpaRepository<Exif, Long> { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.ventulus95.ouathjwt.util; | ||
|
||
import com.drew.imaging.ImageMetadataReader; | ||
import com.drew.imaging.ImageProcessingException; | ||
import com.drew.metadata.Directory; | ||
import com.drew.metadata.Metadata; | ||
import com.drew.metadata.exif.ExifIFD0Directory; | ||
import com.drew.metadata.exif.ExifSubIFDDirectory; | ||
import com.ventulus95.ouathjwt.model.exif.Exif; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class ExifUtil { | ||
|
||
public static Exif imgtoExif(MultipartFile file) throws IOException, ImageProcessingException { | ||
InputStream inputStream = new BufferedInputStream(file.getInputStream()); | ||
Metadata metadata = ImageMetadataReader.readMetadata(file.getInputStream()); | ||
Directory SubDirectory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class); | ||
Directory IFD0Directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class); | ||
String fnum = SubDirectory.getString(ExifSubIFDDirectory.TAG_FNUMBER); | ||
String fl = SubDirectory.getString(ExifSubIFDDirectory.TAG_FOCAL_LENGTH); | ||
String iso = SubDirectory.getString(ExifSubIFDDirectory.TAG_ISO_EQUIVALENT); | ||
String exp = SubDirectory.getString(ExifSubIFDDirectory.TAG_EXPOSURE_TIME); | ||
String model = IFD0Directory.getString(ExifIFD0Directory.TAG_MODEL); | ||
String maker = IFD0Directory.getString(ExifIFD0Directory.TAG_MAKE); | ||
return Exif.builder().aperture(fnum).focusLength(fl).iso(iso).exposureTime(exp).model(model).maker(maker).build(); | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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