- in = r.getInputStream();
- } catch (IOException e) {
- e.printStackTrace();
- Log.log(Picture.class, e);
-
- in = null;
- if (r instanceof Res.Ref) {
- // add extensions to the resource, looking for the image
- Res.Ref ref = (Res.Ref)r;
- Res newr;
-
- String[] exts = new String[] { ".png", ".jpeg", ".gif" };
- for (int i=0; i < exts.length && in == null; i++) {
- newr = ref.addExtension(exts[i]);
- try { in = newr.getInputStream(); }
- catch (IOException f) { in = null; }
- }
- }
+ in = b == null ? Stream.getInputStream(stream) : b.getImage();
+ } catch (IOException e) { Log.error(Picture.class, stream);
+ } catch (JSExn e) { Log.error(Picture.class, stream);