Loading images using workers #298
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that workers are available pretty everywhere I think it would benefit
marzipanoto use them. I created this fork and it works on Chrome and only on Chrome will work until other browsers will implementOffscreenCanvasandcreateImageBitmap, but the workers files must be moved to the public_html/static folder of the website for theWorkerconstructor to be able to load them.I created 3 workers:
createImageBitmapand return the image bitmap; this worker is used when there is no need of transformations on the image;createImageBitmapand then transform it usingOffscreenCanvas.These workers are created in the constructor of
loaders/HtmlImage.jswhere I check which workers are available on the current browser. If the features required for workers are not available we use the current implemented method using<img>I know that there should be some refactoring done and I want to know what I need to refactor.
Also I don't what is the best method to handle the workers files that must be in the public_html/static folder.
I also create a worker for just fetching the the image data and returning a
Bloband then load it normally using<img>but I don't see performance gains from doing this.