1 | // there are random upload errors... |
2 | static int uploadToImageServerIfNotThere_tries = 3; |
3 | |
4 | static S uploadToImageServerIfNotThere(BufferedImage img, S name) {
|
5 | ret uploadToImageServerIfNotThere(null, img, name); |
6 | } |
7 | |
8 | static S uploadToImageServerIfNotThere(File f, BufferedImage img, S name) {
|
9 | S md5 = md5OfRGBImage(new RGBImage(img)); |
10 | Throwable lastException = null; |
11 | for tries to uploadToImageServerIfNotThere_tries: try {
|
12 | long id = imageServerCheckMD5(md5); |
13 | if (id == 0) |
14 | ret uploadToImageServer_new(f, img, name); |
15 | else |
16 | ret snippetImgLink(fsI(id)); |
17 | } catch e {
|
18 | lastException = printException(e); |
19 | } |
20 | fail(lastException); |
21 | } |
22 | |
23 | sS uploadToImageServerIfNotThere(File f) {
|
24 | ret uploadToImageServerIfNotThere(f, loadImage2(f), fileName(f)); |
25 | } |
Began life as a copy of #1004609
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1005826 |
| Snippet name: | uploadToImageServerIfNotThere - returns URL |
| Eternal ID of this version: | #1005826/7 |
| Text MD5: | 10aebd4a204cc649b03277b8620b479d |
| Author: | stefan |
| Category: | javax / images |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-02 09:58:41 |
| Source code size: | 798 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 787 / 856 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |