Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in replaceImage function #1625

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/ReplaceImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Works only in the browser.
function ReplaceImage(ref, selector, steps, options) {
if(!ref.options.inBrowser) return false; // This isn't for Node.js
var tempSequencer = ImageSequencer({ui: false});
var this_ = ref;
if (window.hasOwnProperty('$')) var input = $(selector);
else var input = document.querySelectorAll(selector);
Expand Down Expand Up @@ -41,15 +40,21 @@ function ReplaceImage(ref, selector, steps, options) {
else make(url);

function make(url) {

var tempSequencer = ImageSequencer({ui: false});
harshkhandeparkar marked this conversation as resolved.
Show resolved Hide resolved
tempSequencer.loadImage(url, function(){
// this.addSteps(steps).run({stop:function(){}},function(out){
var sequence = this.addSteps(steps);

tempSequencer.addSteps(steps);

if (ref.detectStringSyntax(steps))
sequence = this.stringToSteps(steps);
sequence.run({stop:function(){}}, function(out){
tempSequencer.stringToSteps(steps);

tempSequencer.run({stop:function(){}}, function(out){
img.src = out;
});

});

}
}

Expand Down