Search code examples
localhostaviary

Aviary local development


Is it possible to test Aviary in a local development machine?

I'm currently testing it from my local development machine but I don't have always a public domain to point to Aviary to post my image.

Do you have a solution?


Solution

  • A little background - the html5 element is unable to load images from a domain that's different from the page it's loaded on. It can however load a base64 string representation of an image without any problems. A technique for getting around this limitation is to "launder" the image before loading it into the canvas. The technique involves downloading the image from a server environment that has access to the image (hence the need for it to be public), converting the image to a base64 string, and returning that string to the browser/client so that it can loaded directly into the canvas instead.

    The Aviary editor uses this technique, which is why the photo needs to be publicly available. For local images, you can do this laundering yourself by creating a local service that converts the image into a base64 string and passes that string as the 'url' parameter when launching the editor.