Bug 1006882: fix various OOMs in Camera and Gallery and make cropResizeRotate() more robust

fix OOM when picking a big image from Gallery

fix OOM when rapidly zooming and swiping in camera filmstrip preview

don't decode arbitrarily large jpegs

modify cropResizeRotate() to use Downsample and add lots of tests

tweak test tolerance to fix travis failure

fix size limit in open.js