Dear Group
Greetings for the Day
I am trying to upload image on
canvas. i used below code
$(document).ready(function () {
$("#ImageUpload").uploadify({
'multi': false,
'queueSizeLimit': 1,
'fileSizeLimit': 0,
'progressData': 'speed',
'swf': 'upscripts/uploadify.swf',
'uploader': 'ImageUpload.ashx?value=a',
'cancelImg': 'upscripts/uploadify-cancel.png',
'buttonImage': 'images/buttons/upload.png',
'folder': 'Uploads',
'auto': true,
'onUploadError': function (file, errorCode, errorMsg,
errorString) {
},
'onUploadSuccess': function (file, response) {
var a = file.name;
var b = "asdfd";
angular.element("#canvascontainer").scope().InsertImage(a);
}
});
Its Working fine with no issue. after uploading image on canvas i am saving
canvas elements in *SVG file*. after that i am trying bind canvas by
reading *svg* file. i am success with binding all text elements with there
attributes(font family,weight,x scale,Y scale etc).
but when i bind image using below code
if (window.DOMParser) {
parser = new DOMParser();
xmlDoc = parser.parseFromString(player[i], "text/xml");
var gValues = xmlDoc.getElementsByTagName("g");
var g1HasImage =
gValues[0].getElementsByTagName("image").length > 0;
if (g1HasImage == true) {
// var appendedimagename =
gValues[0].getAttribute('href');
var Imagedesc =
gValues[0].getElementsByTagName("image")
var appendedimagename =
Imagedesc[0].getAttribute('xlink:href');
var onlyimagname=
appendedimagename.replace(/^.*[\\\/]/, '');
*
angular.element("#canvascontainer").scope().InsertImage(onlyimagname);*
}
*anguler method*
$scope.InsertImage = function (imgname) {
var imgPath = "../../Uploads/a/" + imgname;
fabric.util.loadImage(imgPath, function (img) {
alert(imgPath);
var validations = { maxwidth: 700, maxheight: 400, angle: 0,
scaled: true };
var meta = {};
var left = activeCanvas.getWidth() / 2;
var top = activeCanvas.getHeight() / 2.15;
var controls = { groupOperations: true, addToFront: true,
leftAlign: true, rightAlign: true, centerAlign: true };
var option = { name: 'image', left: left, top: top,
hasRotatingPoint: true, validations: validations, controls: controls, meta:
meta };
var newImage = new fabric.Legimg(img, option);
newImage.setWidth(activeCanvas.getWidth() / 2.8);
newImage.setHeight(activeCanvas.getHeight() / 4.2);
activeCanvas.add(newImage);
activeCanvas.renderAll();
});
activeCanvas.calcOffset();
this.getsvg(activeCanvas);
this.addState(activeCanvas);
// imgname.dragEnd();
}
its not working. how can i rebind image to canvas from svg
Many Thanks
Narasappa
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.