KnicKnic / WASM-ImageMagick

Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples and tutorials should reference NPM

KnicKnic opened this issue · comments

Problem

Current sample code references my private version of hosted imagemagick wasm binaries on my github page.

  1. It is not versioned
  2. Not guaranteed up to date
  3. not guaranteed to not change over time

Solution

Use a CDN that automatically pulls from npm. This gives versioning, guaranteed upto date as well as speed.

Which CDN

Current plan is to use unpkg.com . I chose it because it was shorter a shorter url.

@cancerberoSgx Should we use a different one?

// import * as Magick from 'https://knicknic.github.io/wasm-imagemagick/magickApi.js';
import * as Magick from 'https://unpkg.com/wasm-imagemagick/dist/bundles/magickApi.js';

Notable

Well currently the samples are hosted on knicknic.github.io/imagemagick/rotate however when I updated the code to use the CDN it didn't work

It appears that ublock prevents this cross domain loading of wasm files involving github via easylist uBlockOrigin/uAssets#2309

Additional work

We should at least include in instructions an issue about this loading of wasm files. And in sample code we should detect (via window.location (are we on github.io if so say we should be loading locally rather than cross domain) and raise an alert).