[15281] | 1 | #ifndef THUMB_H |
---|
| 2 | #define THUMB_H |
---|
| 3 | |
---|
[15284] | 4 | char* checkthumb(char* path, char* file) |
---|
[15281] | 5 | { |
---|
[15284] | 6 | char* tmpstr = NULL; |
---|
| 7 | |
---|
| 8 | tmpstr = ostrcat(createpath(path, "/.Thumbnails/"), file, 1, 0); |
---|
| 9 | if(file_exist(tmpstr)) |
---|
| 10 | return tmpstr; |
---|
| 11 | |
---|
| 12 | return NULL; |
---|
[15281] | 13 | } |
---|
| 14 | |
---|
| 15 | void thumbthread(struct stimerthread* self) |
---|
| 16 | { |
---|
| 17 | int width = 0, height = 0; |
---|
| 18 | unsigned char* buf = NULL; |
---|
| 19 | struct queue* qe = NULL; |
---|
[15284] | 20 | char* thumbfile = NULL; |
---|
[15281] | 21 | |
---|
| 22 | if(self == NULL) return; |
---|
| 23 | |
---|
| 24 | debug(307, "start thumb thread"); |
---|
| 25 | |
---|
| 26 | while(self->aktion != STOP) |
---|
| 27 | { |
---|
[15297] | 28 | sleep(5); |
---|
[15281] | 29 | |
---|
| 30 | qe = getqueue(101); |
---|
| 31 | while(qe != NULL) |
---|
| 32 | { |
---|
[15287] | 33 | buf = loadjpg((char*)qe->data, &width, &height, 16); |
---|
[15281] | 34 | if(buf != NULL) |
---|
| 35 | { |
---|
| 36 | buf = scale(buf, width, height, 3, 100, 100, 1); |
---|
| 37 | if(buf != NULL) |
---|
| 38 | { |
---|
[15284] | 39 | thumbfile = ostrcat(thumbfile, (char*)qe->data, 1, 0); |
---|
| 40 | thumbfile = ostrcat(thumbfile, "/.Thumbnails", 1, 0); |
---|
| 41 | mkdir(thumbfile, 777); |
---|
| 42 | |
---|
| 43 | thumbfile = ostrcat(thumbfile, "/", 1, 0); |
---|
| 44 | thumbfile = ostrcat(thumbfile, (char*)qe->data1, 1, 0); |
---|
[15281] | 45 | |
---|
| 46 | debug(307, "create thumb: %s from %s", thumbfile, (char*)qe->data); |
---|
| 47 | savejpg(thumbfile, 100, 100, buf); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | free(buf); buf = NULL; |
---|
| 52 | free(thumbfile); thumbfile = NULL; |
---|
| 53 | delqueue(qe, 0); |
---|
[15284] | 54 | qe = getqueue(101); |
---|
[15281] | 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | debug(307, "end thumb thread"); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | #endif |
---|