Change Image with Jquery? setElementParameters works with text

Posted almost 8 years ago by Dp4

Post a topic
Answered
D
Dp4

How can I replace an initial image with jquery? I was able to change text with fancyProductDesigner.setElementParameters({text:"hello world"},"title"); however when I try to change image type and change the "source" parameter nothing is changed.  Can someone help me understand which parameter I need to change so that the canvas image source is swapped out?

0 Votes

D

Dp4 posted almost 8 years ago Best Answer

Just to answer my own question, the new image needs to be added as a replacement.

0 Votes


5 Comments

Sorted by
M

Michael Eckebrecht posted about 7 years ago

Ok, I solved the issue myself.

$(this).find('picture').on('click', function(evt) {

    var imagePath = $(this).attr("data-img");

    if(typeof(yourDesigner.getElementByTitle('NewImage')) !== 'undefined' ) {

        yourDesigner.addCustomImage(imagePath, 'NewImage'); 

    }

});


thx.

0 Votes

M

Michael Eckebrecht posted about 7 years ago

Hello DP4,

have you got simple example for me, how will be work´s?

I try to change the source-parameter in jQuery like this:


$(this).find('picture').on('click', function(evt) {

    var imagePath = $(this).attr("data-img");

    if(typeof(yourDesigner.getElementByTitle('NewImage')) !== 'undefined' ) {

        yourDesigner.replace = imagePath;

    }

});


thank´s for up :)

0 Votes

7

7up posted over 7 years ago

i am have this problem too, fancyProductDesigner.setElementParameters do anithing and don't change image.


p.s.

i try use this for changing boundingbox (transparancy image), for example i need to change boundingbox size on t-shirt print like A5, A4, A3 and change proper price for this format. Change price are work ok, but when i try to change img, nothing happens.

0 Votes

B

Brad posted almost 8 years ago

I am trying to accomplish both of these things you mentioned, but I'm not having any luck. Are you using the Wordpress version?


Would you mind sharing a bit of your code? I've tried using this code in the footer of my site, but it doesn't work:

fancyProductDesigner.setElementParameters({text:"hello world"},"firstdate");



0 Votes

D

Dp4 posted almost 8 years ago Answer

Just to answer my own question, the new image needs to be added as a replacement.

0 Votes

Login or Sign up to post a comment