diff --git a/README.txt b/README.txt index cec4d0b..a67a9fa 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Performance: 11 sec when processing a 564kb database containing - 1685 rows on orange pi 4 lts (cpu freq: 816Mhz) + 1685 files on orange pi 4 lts (cpu freq: 816Mhz) And 5sec at 1.8GHz diff --git a/config.h b/config.h index 867865e..36937fe 100644 --- a/config.h +++ b/config.h @@ -1,12 +1,12 @@ /* Absolute path to */ -#define ROOT "." +#define ROOT "8img_dir" #define DB ROOT"/db" /* Html generator */ #define CSS "style.css" -#define LOGO "logo.jpg" +#define LOGO "logo.png" -#define DESC "from outer space" +#define DESC "-> from outer space" #define TITLE "8img gallery" #define POST_PER_PAGE 5 diff --git a/img.c b/img.c index 3329311..8fc0f44 100644 --- a/img.c +++ b/img.c @@ -189,7 +189,7 @@ struct DB_STR *new_db_value(char *str) { *ptr = '\0'; for (size_t i = 0; i < strlen(tok); i++) - if (tok[i] == ',') + if (tok[i] == ',' && tok[i + 1]) db->size++; size_t allocated = 0; @@ -256,14 +256,14 @@ RDB_CLOSE: } struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db, const size_t page, const size_t pages) { - fprintf(fp, "\n\n\n%s\n\n\n

%s
%s/p%zu

\n
", CSS, TITLE, LOGO, DESC, file, page); + fprintf(fp, "\n\n\n%s\n\n\n

%s
%s/p%zu

\n", CSS, TITLE, LOGO, DESC, file, page); /* Tags */ - fputs("\nall", fp); + fputs("
\nall", fp); for (size_t i = 0; i < ut.size; i++) - fprintf(fp, " %s", ut.tags[i], ut.tags[i]); + fprintf(fp, " %s", ut.tags[i], ut.tags[i]); - fputs("\n


\n", fp); + fputs("\n


\n", fp); /* Images */ size_t images = 0; @@ -282,9 +282,9 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, } } - fprintf(fp, "%s
", p->filename, p->filename, p->filename); + fprintf(fp, "\n%s
\n>", p->filename, p->filename, p->filename); for (size_t i = 0; i < p->size; i++) - fprintf(fp, " %s", p->tags[i], p->tags[i]); + fprintf(fp, " %s", p->tags[i], p->tags[i]); fputs("\n


\n", fp); @@ -294,7 +294,7 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, break; } - fputs("\n
\n", fp); + fputs("
\n", fp); for (size_t i = 0; i <= pages; i++) { if (i == 0) { if (i == page) @@ -317,7 +317,7 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, } - fprintf(fp, "\n
\n
\n\n\n"); + fprintf(fp, "\n\n\n\n"); return p; } @@ -331,7 +331,7 @@ void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) { while (p != NULL) { struct DB_STR *i = p->next; - if (count == POST_PER_PAGE) { + if (count > POST_PER_PAGE) { count = 0; pages++; } diff --git a/logo.png b/logo.png index 93eecb4..fd18ed1 100644 Binary files a/logo.png and b/logo.png differ diff --git a/style.css b/style.css index e373ec4..4df0b85 100644 --- a/style.css +++ b/style.css @@ -1,36 +1,32 @@ +/* Global */ body { + word-break: break-word; + margin: auto; padding: 2em; + + background-color: #1d2021; + color: #928374; } a { text-decoration: none; - color: #000000; -} - -/* */ -#logo { - display: block; - max-width: 10%; + color: #ebdbb2; } -#desc { - color: #000000; +/* Tags */ +.alltags { + background-color: #ebdbb2; } -.tags { - color: #000000; +.alltags a { + color: #1d2021; } -/* */ -.pager {} -.pager a { +/* Pager */ +.pager #curr { text-decoration: underline; } -.pager #curr { - color: #ffffff; - background-color: #000000; -}