seivadnosaj.appspot.com

Fork me on GitHub

Various utilities running on Google App Engine.

Proxy

This is a handy JSONP proxy. For example, this can be used to load an image from any URL and bypass the browser's same-origin security policy when manipulating the pixel data via <canvas>.

Note: App Engine seems to have a fairly aggressive caching policy, so you may need to pass something like Cache-Control: max-age=0 in the request headers depending on your application.

Usage

$.get('http://seivadnosaj.appspot.com/proxy', {
  url: 'http://www.jasondavies.com/media/img/jason.jpg'
}, function(data) {
  var img = new Image();
  img.onload = function() {
    var w = img.width, h = img.height;
    $('#canvas').attr('width', w).attr('height', h);
    context.width = w; context.height = h;
    context.drawImage(img, 0, 0, w, h);
  };
  img.src = data;
}, 'jsonp');

Demo

When the image has loaded, click on it to view its negative.

In the Wild

Created by Jason Davies.