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)

static S uploadJPEGToImageServer(S path) {
  ret uploadJPEGToImageServer(newFile(path));
}

static S uploadJPEGToImageServer(File f) {
  ret uploadJPEGToImageServer(loadImage2(f), fileName(f));
}

static S uploadJPEGToImageServer(BufferedImage img, S name) {
  byte[] jpeg = toJPEG(img);
  S md5 = md5OfRGBImage(new RGBImage(imageFromByteArray(jpeg))); // take artifacts into account
  long id = imageServerCheckMD5(md5);
  if (id == 0)
    ret uploadToImageServer_new_jpg(jpeg, name);
  else
    ret imageServerURL() + "raw/" + id;
}

static S uploadJPEGToImageServer(S name, BufferedImage img) {
  ret uploadJPEGToImageServer(img, name);
}

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: 545 / 601
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)