전체 글(809)
-
Spring boot 이미지 stream 또는 base64로 넘기기
StreamSpring bootimport org.springframework.core.io.Resource;import org.springframework.core.io.UrlResource;import org.springframework.http.HttpHeaders;import org.springframework.http.MediaType;import org.springframework.http.ResponseEntity;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.a..
2024.12.05 -
Sencha 이미지 사이즈 정보 가져오기
Case1Ext.application({ name: 'ImageSizeApp', launch: function () { Ext.create('Ext.container.Viewport', { layout: 'fit', items: [ { xtype: 'image', src: 'https://via.placeholder.com/150', // Replace with your image URL alt: 'Example Image', listeners: { ..
2024.12.05 -
Javascript 윈도우, 리눅스 상관없이 파일 경로 처리 하기
const filePath = "C:\\Users\\Public/Documents/file.txt";// Split the path into componentsconst components = filePath.split(/[\/\\]/);console.log(components);// Output: ['C:', 'Users', 'Public', 'Documents', 'file.txt']
2024.12.05 -
Javascript split 함수에 정규식 적용하기
'콤마, 세미콜론, 파이프'로 나누기const text = "apple,banana;cherry|date";const result = text.split(/[,;|]/); // Split on commas, semicolons, or pipesconsole.log(result);// Output: ['apple', 'banana', 'cherry', 'date']'스페이스바'로 나누기const text = "Hello World How Are You";const result = text.split(/\s+/); // Split on one or more spacesconsole.log(result);// Output: ['Hello', 'World', 'How', 'Are', 'You']2개만 ..
2024.12.05 -
Spring boot 이미지 Map으로 전달하기
Spring boot@RestController@RequestMapping("/api")public class ResourceController { @GetMapping("/resource-with-map") public ResponseEntity> getResourceWithMap() throws IOException { // Load the resource (example: an image) Path imagePath = Paths.get("/path/to/your/image.jpg"); Resource resource = new UrlResource(imagePath.toUri()); if (!resource.exists() || !res..
2024.12.05 -
Spring boot URL로 access되지 않는 이미지 웹으로 전달하기
Spring bootimport org.springframework.core.io.Resource@RestController@RequestMapping("/images")public class ImageController { @GetMapping("/{imageName}") public ResponseEntity getImage(@PathVariable String imageName) throws IOException { Path imagePath = Paths.get("/path/to/your/private/images/" + imageName); Resource resource = new UrlResource(imagePath.toUri()); if (..
2024.12.05