[EDIT] Il manquait xmlns:xlink="http://www.w3.org/1999/xlink"
dans le tag SVG. Ca ne règle pas mon souci d’image qui disparaît mais ça explique l’erreur
On dirait que ça plante à la génération du png du Modèle.
Error unable to generate image from src = data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" class="diagram" data-model="613" width="182" height="200"><style>svg{font-family:"Helvetica Neue",Helvetica,sans-serif;font-size:12px;background-color:%23fff}svg .note .border{fill:%23f9ed5a;stroke:%23b5af62}svg .cont .border,svg .node .border,svg .caption .border{fill:%23fff;stroke:%23000}svg .cont .sep,svg .node .sep,svg .caption .sep{stroke:%23000}svg .cont .head{stroke:none;fill:none;fill-opacity:.5}svg .cont .border{fill-opacity:.2}svg .cont text{font-weight:bold}svg .node .item rect{fill:none;stroke:none}svg .node .item text{dominant-baseline:text-after-edge;alignment-baseline:after-edge;fill:%23000}svg .node .item.title rect{fill-opacity:.3}svg .node .item.title text{font-weight:bold}svg .node .item.empty text{text-anchor:middle}svg .caption text.title{font-weight:bold}svg .resize{fill:none;stroke:transparent;stroke-opacity:0;stroke-width:5px}svg .shape{fill:%23fff;stroke:%23000}svg .shape-title{font-weight:bold;fill:%23000;dominant-baseline:text-after-edge;alignment-baseline:after-edge;text-anchor:middle}svg .link .border{fill:none;stroke:transparent;stroke-opacity:0;stroke-width:10px}svg .link .road{fill:none;stroke:%23000;stroke-width:1.5;stroke-linejoin:round;stroke-linecap:round}svg .link .road.dashed{stroke-dasharray:5}svg .link .link-label{text-anchor:middle}</style><defs><filter id="shadow" height="130%"><feGaussianBlur in="SourceAlpha" stdDeviation="3"></feGaussianBlur><feOffset dx="2" dy="2" result="offsetblur"></feOffset><feComponentTransfer><feFuncA type="linear" slope="0.5"></feFuncA></feComponentTransfer><feMerge><feMergeNode></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter><marker id="start_1" markerWidth="12" markerHeight="12" refX="2" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10" fill="none" stroke="%23000"></path></marker><marker id="end_1" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M2,2 L10,6 L2,10" fill="none" stroke="%23000"></path></marker><marker id="start_2" markerWidth="12" markerHeight="12" refX="2" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10z" fill="%23fff" stroke="%23000"></path></marker><marker id="end_2" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M2,2 L10,6 L2,10z" fill="%23fff" stroke="%23000"></path></marker><marker id="start_3" markerWidth="22" markerHeight="12" refX="2" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10 L18,6z" fill="%23000" stroke="%23000"></path></marker><marker id="end_3" markerWidth="22" markerHeight="12" refX="19" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10 L18,6z" fill="%23000" stroke="%23000"></path></marker><marker id="start_4" markerWidth="22" markerHeight="12" refX="2" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10 L18,6z" fill="%23fff" stroke="%23000"></path></marker><marker id="end_4" markerWidth="22" markerHeight="12" refX="19" refY="6" orient="auto" markerUnits="strokeWidth"><path d="M10,2 L2,6 L10,10 L18,6z" fill="%23fff" stroke="%23000"></path></marker><marker id="start_6" markerWidth="16" markerHeight="16" refX="2" refY="8" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L16,8 L0,16" fill="none" stroke="%23000"></path></marker><marker id="end_6" markerWidth="12" markerHeight="16" refX="15" refY="8" orient="auto" markerUnits="strokeWidth"><path d="M16,0 L0,8 L16,16" fill="none" stroke="%23000"></path></marker></defs><g class="viewport" data-grid="0" transform="matrix(1 0 0 1 0 0)" data-zoom="1" data-x="0" data-y="0"><g class="background"></g><g class="body"><g class="containers"></g><g class="links"></g><g class="nodes"><g data-x="20" data-y="20" transform="translate(20 20)" data-color="%23EA9999" class="node" data-obj="RciApplication" data-id="1587" data-tpl="FloApp_app_send" data-keys="{"rciAppTechnicalId":"APP-1587t","rciAppVersion":1}" data-w="142.0221405029297" data-h="43.33333206176758"><rect x="0" y="0" width="142.0221405029297" height="43.33333206176758" rx="5" ry="5" class="border" filter="url(%23shadow)"></rect><g class="content" data-obj="RciApplication"><g class="item title empty" data-id="1587"><rect x="1" y="0" width="140.0221405029297" height="43.33333206176758" class="border-item" rx="5" ry="5" style="fill: rgb(232, 116, 36);"></rect><text x="71.01107025146484" y="21.66666603088379" dy="0.5em">AGREE 21 (RCI DE) </text></g></g></g><g data-x="50" data-y="50" transform="translate(50 50)" class="note legend" data-id="1" data-w="48.052085876464844" data-h="21.33333396911621"><rect x="0" y="0" width="48.052085876464844" height="21.33333396911621" class="border" style="fill: rgb(249, 237, 90);"></rect><text y="0"><tspan x="4" dy="1.2em" data-eol="1">Legend</tspan></text><rect x="0" y="0" width="48.052085876464844" height="21.33333396911621" class="resize"></rect><image x="0" y="30" width="100" height="100" xlink:href="/resource?type=IMG&code=ECB_DIVISION_LEGEND" class="image"></image></g></g></g><g class="foreground"></g></g></svg>
Je tombe dans le onerror mais je n’arrive pas à débugger parce que tout ce qu’il fait juste avant c’est un new Image() …
this.img2base64 = function(src, format, w, h, cbk) {
let im = new Image();
im.onload = ()=>{
w = Math.round(w === null ? im.width : (w === 0 && im.height ? im.width * h / im.height : w));
h = Math.round(h === null ? im.height : (h === 0 && im.width ? im.height * w / im.width : h));
let c = document.createElement("canvas"), ctx = c.getContext("2d"), data;
c.width = w;
c.height = h;
ctx.drawImage(im, 0, 0, w, h);
data = c.toDataURL("image/" + (format || "png"));
$(im).remove();
c = null;
cbk && cbk(data, w, h);
}
;
im.onerror = ()=>{
console.log("Error unable to generate image from src = " + src);
cbk && cbk("", 0, 0);
}