Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1004271 // loadImageAsFile - returns File - todo: merge with loadBufferedImage code

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3651L/25K).

ifndef Android
please include function loadBufferedImage.
endifndef

static File loadImageAsFile(String snippetIDOrURL) ctex {
  if (isURL(snippetIDOrURL))
    fail("not implemented");

  if (!isSnippetID(snippetIDOrURL)) fail("Not a URL or snippet ID: " + snippetIDOrURL);
  S snippetID = "" + parseSnippetID(snippetIDOrURL);
  
  File file = imageSnippetCacheFile(snippetID);
  if (fileSize(file) > 0) ret file;

  String imageURL = snippetImageURL_noHttps(snippetID);
  System.err.println("Loading image: " + imageURL);
  byte[] data = loadBinaryPage(imageURL);

  saveBinaryFile(file, data);
  return file;
}

Author comment

Began life as a copy of #1003723

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1004271
Snippet name: loadImageAsFile - returns File - todo: merge with loadBufferedImage code
Eternal ID of this version: #1004271/8
Text MD5: 23d2b01eb2ec8250de9fe02b18823a10
Transpilation MD5: bfdda8739fdc1cfc2b35250bb6960de8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-24 14:17:57
Source code size: 634 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 599 / 646
Version history: 7 change(s)
Referenced in: [show references]