Bugfix: In creation of a new app, only one image is now shown

This commit is contained in:
Isoporhode
2021-11-14 19:30:12 +01:00
parent fb3f45d008
commit 80b18a4f6a
+27 -28
View File
@@ -4330,34 +4330,34 @@ const AppCreator = (props) => {
canvas.width = 174; canvas.width = 174;
canvas.height = 174; canvas.height = 174;
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
if (img)
img.onload = function () {
// img, x, y, width, height
//ctx.drawImage(img, 174, 174)
//console.log("IMG natural: ", img.naturalWidth, img.naturalHeight)
//ctx.drawImage(img, 0, 0, 174, 174)
ctx.drawImage(
img,
0,
0,
img.width,
img.height,
0,
0,
canvas.width,
canvas.height
);
img.onload = function () { try {
// img, x, y, width, height const canvasUrl = canvas.toDataURL();
//ctx.drawImage(img, 174, 174) if (canvasUrl !== fileBase64) {
//console.log("IMG natural: ", img.naturalWidth, img.naturalHeight) //console.log("SET URL TO: ", canvasUrl)
//ctx.drawImage(img, 0, 0, 174, 174) setFileBase64(canvasUrl);
ctx.drawImage( }
img, } catch (e) {
0, alert.error("Failed to parse canvasurl!");
0,
img.width,
img.height,
0,
0,
canvas.width,
canvas.height
);
try {
const canvasUrl = canvas.toDataURL();
if (canvasUrl !== fileBase64) {
//console.log("SET URL TO: ", canvasUrl)
setFileBase64(canvasUrl);
} }
} catch (e) { };
alert.error("Failed to parse canvasurl!");
}
};
//console.log(img.width) //console.log(img.width)
//console.log(img.width) //console.log(img.width)
@@ -4626,8 +4626,7 @@ const AppCreator = (props) => {
setOpenImageModal(true); setOpenImageModal(true);
}} }}
> >
{!imageData && alternateImg} {imageData ? imageInfo : alternateImg}
{imageInfo}
<input <input
hidden hidden
type="file" type="file"