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

21
LINES

< > BotCompany Repo | #1009029 // uploadJPEGToImageServer - returns URL

JavaX fragment (include)

1  
static S uploadJPEGToImageServer(S path) {
2  
  ret uploadJPEGToImageServer(newFile(path));
3  
}
4  
5  
static S uploadJPEGToImageServer(File f) {
6  
  ret uploadJPEGToImageServer(loadImage2(f), fileName(f));
7  
}
8  
9  
static S uploadJPEGToImageServer(BufferedImage img, S name) {
10  
  byte[] jpeg = toJPEG(img);
11  
  S md5 = md5OfRGBImage(new RGBImage(imageFromByteArray(jpeg))); // take artifacts into account
12  
  long id = imageServerCheckMD5(md5);
13  
  if (id == 0)
14  
    ret uploadToImageServer_new_jpg(jpeg, name);
15  
  else
16  
    ret imageServerURL() + "raw/" + id;
17  
}
18  
19  
static S uploadJPEGToImageServer(S name, BufferedImage img) {
20  
  ret uploadJPEGToImageServer(img, name);
21  
}

Author comment

Began life as a copy of #1005826

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009029
Snippet name: uploadJPEGToImageServer - returns URL
Eternal ID of this version: #1009029/7
Text MD5: 89a2fa70e7c185f7a7f9c86ccc4a9991
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-26 10:10:17
Source code size: 661 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 546 / 602
Version history: 6 change(s)
Referenced in: [show references]