diff --git a/assets/2rectangle.svg b/assets/2rectangle.svg new file mode 100644 index 0000000000000000000000000000000000000000..d34ba638ab5e30d52bda9d75be16c8449ea0469c --- /dev/null +++ b/assets/2rectangle.svg @@ -0,0 +1,18 @@ +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1215" + height="684"> + <defs/> + <g> + <g> + <path fill="rgb(255,0,0)" stroke="rgb(255,0,0)" paint-order="fill stroke markers" + d=" M 188 197.66666412353516 L 477 197.66666412353516 L 477 524.6666641235352 L 188 524.6666641235352 L 188 197.66666412353516 Z Z" + fill-opacity="0.5" stroke-opacity="0.5" stroke-miterlimit="10" stroke-width="12.65625" + stroke-dasharray=""/> + </g> + <g> + <path fill="rgb(255,0,0)" stroke="rgb(255,0,0)" paint-order="fill stroke markers" + d=" M 625 194.66666412353513 L 916 194.66666412353513 L 916 577.6666641235352 L 625 577.6666641235352 L 625 194.66666412353513 Z Z" + fill-opacity="0.5" stroke-opacity="0.5" stroke-miterlimit="10" stroke-width="12.65625" + stroke-dasharray=""/> + </g> + </g> +</svg> diff --git a/assets/cayenne.svg b/assets/cayenne.svg new file mode 100644 index 0000000000000000000000000000000000000000..df935a78b1c1d93db7f1cd5488b082be3943bade --- /dev/null +++ b/assets/cayenne.svg @@ -0,0 +1,16 @@ +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1215" height="684"> + <defs/> + <g> + <g> + <path fill="rgb(255,0,0)" stroke="rgb(255,0,0)" d=" M 143 124.66666412353516 L 392 124.66666412353516 L 392 354.66666412353516 L 143 354.66666412353516 L 143 124.66666412353516 Z Z" fill-opacity="0.5" stroke-opacity="0.5" stroke-miterlimit="10" stroke-width="12.65625" stroke-dasharray=""/> + </g> + <g> + <image width="1800" height="963" preserveAspectRatio="none" transform="matrix(0.3266922638266449 0 0 0.3266922638266448 478.0164251120414 122.79378743494328)" xlink:href="https://presskit.porsche.de/models/assets/images/e/P17_0701_a5_rgb-c04a4c6e.jpg"/> + </g> + <g> + <g> + <text fill="red" stroke="none" font-family="Arial" font-size="40px" font-style="normal" font-weight="normal" text-decoration="undefined" x="0" y="20" text-anchor="start" dominant-baseline="central" transform="matrix(0.6328125 0 0 0.6328125 332.99999999999994 538.6666641235352)">Mon gros Cayenne</text> + </g> + </g> + </g> +</svg> diff --git a/demo/src/index.js b/demo/src/index.js index a96301518568e568d6488b75af7049b5769fca6e..03d5820756573f51b420ce253481d11f089fcf4c 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -11,7 +11,7 @@ const config = { exportLocalStorageAnnotations: false, // display annotation JSON export button }, catalog: [ - { manifestIf: 'https://files.tetras-libre.fr/dev/Clock/manifest.json'}, + { manifestId: 'https://files.tetras-libre.fr/dev/Clock/manifest.json' }, { manifestId: 'https://files.tetras-libre.fr/dev/Hakanai/manifest/manifest.json' }, { manifestId: 'https://dzkimgs.l.u-tokyo.ac.jp/videos/iiif_in_japan_2017/manifest.json' }, { manifestId: 'https://iiif.io/api/cookbook/recipe/0219-using-caption-file/manifest.json' }, diff --git a/src/AnnotationCreationUtils.js b/src/AnnotationCreationUtils.js index 56607591b0ea4491e0a9b8422054ab0935020ce3..5c3476bf5856b7e1b3b22f324fa405e239aef273 100644 --- a/src/AnnotationCreationUtils.js +++ b/src/AnnotationCreationUtils.js @@ -1,6 +1,7 @@ import {exportStageSVG} from "react-konva-to-svg"; import WebAnnotation from "./WebAnnotation"; import {v4 as uuid} from "uuid"; +import axios from 'axios'; /** Extract time information from annotation target */ export function timeFromAnnoTarget(annotarget) { @@ -74,7 +75,9 @@ const dumbAnnotation = { export function saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, drawingStateSerialized, svg, tags){ // TODO promises not handled. Use promiseAll ? - canvases.forEach(async (canvas) => { + + + canvases.forEach(async (canvas) => { const storageAdapter = config.annotation.adapter(canvas.id); // const anno = new WebAnnotation({ // body, @@ -107,3 +110,22 @@ export function saveAnnotation(canvases, config, receiveAnnotation, annotation, } }); } + +const sendFile = async () => { + const fileContent = 'Hello, this is a test file'; + const blob = new Blob([fileContent], { type: 'text/plain' }); + + const formData = new FormData(); + formData.append('file', blob); + + try { + const response = await axios.post('http://localhost:3001/upload', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); + console.log('File Uploaded', response.data); + } catch (error) { + console.error('Error uploading file:', error); + } +}