dev conver files
Test Workflow / test (push) Successful in 5s

This commit is contained in:
vladp
2026-02-26 00:49:13 +07:00
parent 4f2d97d205
commit b8003c11e2
@@ -26,17 +26,11 @@ public class ImageResizeService {
@Value("${file.storage.base-path}")
private String storagePath;
/**
* Проверяет, является ли файл изображением
*/
public boolean isImage(String extension) {
return extension != null && List.of("jpg", "jpeg", "png", "gif", "webp")
.contains(extension.toLowerCase());
}
/**
* Генерирует два размера для изображения
*/
@Transactional
public void generateSizes(FileEntity file, byte[] data) throws IOException {
if (!isImage(file.getFileExtension())) {
@@ -65,9 +59,6 @@ public class ImageResizeService {
}
}
/**
* Ресайзит и сохраняет
*/
private String resizeAndSave(BufferedImage original, String fileName, int targetWidth) throws IOException {
int targetHeight = (int) ((double) original.getHeight() / original.getWidth() * targetWidth);
@@ -86,9 +77,6 @@ public class ImageResizeService {
return filePath.toString();
}
/**
* Получить путь к нужному размеру
*/
public String getPath(FileEntity file, String size) {
if ("thumbnail".equals(size) && file.getThumbnailPath() != null) {