From 2a3c708291d807b9e5fa40ce56f3fc13caa32469 Mon Sep 17 00:00:00 2001 From: Marlon Portmann <> Date: Wed, 16 Nov 2022 10:56:02 +0100 Subject: [PATCH] 1 image only --- js/functions.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/js/functions.js b/js/functions.js index 6d2e82c..22bbb57 100644 --- a/js/functions.js +++ b/js/functions.js @@ -55,7 +55,7 @@ $(document).ready(function(){ } - + }) @@ -68,7 +68,7 @@ function openOverlay(){ $("#cancel").click(function() { document.getElementById("overlay_container").innerHTML = ""; $("#overlay").removeClass("show").addClass("hidden") - + }) } @@ -145,13 +145,13 @@ function ideeAnzeigen(data) { let img = $("").addClass("previewImage"); img.attr("src", imgUrlArr[i]); img.appendTo(bildContainer); - + } - + bildContainer.prependTo($("#overlay_container")) } - + /* let bild = document.createElement("img"); @@ -373,7 +373,7 @@ function formularErstellen(koordianten) { titel_input.setAttribute("name", "titel"); titel_input.setAttribute("placeholder", "titel"); - + let text_input = document.createElement("input"); text_input.setAttribute("type", "textarea"); @@ -389,7 +389,7 @@ function formularErstellen(koordianten) { submit_input.setAttribute("value", "Formular Absenden"); - document.getElementById("form").appendChild(titel_input); + document.getElementById("form").appendChild(titel_input); document.getElementById("form").appendChild(text_input); document.getElementById("form").appendChild(submit_input); document.getElementById("form").appendChild(koordinaten_lat); @@ -397,16 +397,16 @@ function formularErstellen(koordianten) { document.getElementById("form").appendChild(image_links); let imageUpload = $('
') - imageUpload.html('') + imageUpload.html('') imageUpload.appendTo("#overlay_container"); - + // get a widget reference - const widget = uploadcare.Widget("[role=uploadcare-uploader]", { multiple: true}); + const widget = uploadcare.Widget("[role=uploadcare-uploader]", { multiple: false}); // listen to the "upload completed" event - widget.onUploadComplete(fileGroupInfo => { + widget.onUploadComplete(fileInfo => { // get a information about uploaded group // check https://uploadcare.com/docs/file-uploader-api/file-groups/#file-group-info @@ -415,19 +415,15 @@ function formularErstellen(koordianten) { $("
").addClass("ImgPrevContainer").appendTo($("div.image-preview")); - for (var i = 0; i < fileGroupInfo.count; i++) { - ImgUrl = "https://ucarecdn.com/" + fileGroupInfo.uuid + "/nth/" + i + "/-/preview/-/quality/smart/-/format/auto/"; - + ImgUrl = "https://ucarecdn.com/" + fileInfo.uuid + "/-/preview/-/quality/smart/-/format/auto/"; + console.log(fileInfo); linkArr.push(ImgUrl); + createImgPrev(ImgUrl + "-/resize/x100/"); //img Preview 100 pixels high - - - }; - let linkArrString = JSON.stringify(linkArr); console.log(linkArrString); image_links.value = linkArrString; @@ -518,7 +514,7 @@ function kommentareAnzeigen(idee_id){ - + }