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).

1  
ifndef Android
2  
please include function loadBufferedImage.
3  
endifndef
4  
5  
static File loadImageAsFile(String snippetIDOrURL) ctex {
6  
  if (isURL(snippetIDOrURL))
7  
    fail("not implemented");
8  
9  
  if (!isSnippetID(snippetIDOrURL)) fail("Not a URL or snippet ID: " + snippetIDOrURL);
10  
  S snippetID = "" + parseSnippetID(snippetIDOrURL);
11  
  
12  
  File file = imageSnippetCacheFile(snippetID);
13  
  if (fileSize(file) > 0) ret file;
14  
15  
  String imageURL = snippetImageURL_noHttps(snippetID);
16  
  System.err.println("Loading image: " + imageURL);
17  
  byte[] data = loadBinaryPage(imageURL);
18  
19  
  saveBinaryFile(file, data);
20  
  return file;
21  
}

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: 603 / 651
Version history: 7 change(s)
Referenced in: [show references]