1
我想加载保存在画布上的svg,以便我可以修改并再次保存。所以我得到的隐藏字段的阵列,并加载该数组中的画布:在画布上在第二次刷新浏览器后在画布上加载svg图像
<input type="hidden" name="insert_arry" value='<?=htmlspecialchars($get_result[$insert])?>' id="insert_arry">
// script for loading the json array of svg on canvas
// loading the view of canvas here
opc_Canvas_Load(
opc_View[opc_Current_View].path.replace('thumb','large'),
opc_Current_View
);
responsive_slide('opc_Product_Slider', 'pWrapper');
jq(window).resize(function() {
opc_Canvas_Load(opc_OverlayImg, opc_Current_View);
});
// tried to load the div first of canvas using jquery, won't work
$(".handler-area").first().css('display', 'block');
// getting the array stored in to the hidden field
var insert_arry = jq('#insert_arry').val();
// loading the json array in canvas
canvas.loadFromJSON(insert_arry.substring(1, insert_arry.length - 1));
对象加载,但它显示了在浏览器中刷新图像。这可能是图像加载问题,但无法找到确切的解决问题。
'loadFromJSON'来自fabric.js库?你可以添加一个[MCVE],其中包含一些代替'<= = htmlspecialchars($ get_result [$ insert])?>'的最小数据。 – Kaiido
[{“objects”:[],“background”:“”,“backgroundImage”:{“type”:“image”,“originX”:“left”,“originY”:“top”,“left” 0, “顶部”:0, “宽度”:1200, “高度”:960, “填充”: “RGB(0,0,0)”, “行程”:NULL, “strokeWidth”:1, “strokeDashArray” :NULL, “strokeLineCap”: “对接”, “strokeLineJoin”: “斜切”, “strokeMiterLimit”:10 “将scaleX”:1, “的scaleY”:1, “角度”:0 “flipX”:假” flipY“:false}] – Harsh
它的太大阵列,所以我不能把所有内容放在数组中..我只是缩短了数组内容。 – Harsh