From b5b7acb88fdbf1d4c10ebcb8dcbecf08a830e3ba Mon Sep 17 00:00:00 2001
From: 8nl <8nl@noreply.git.macaw.me>
Date: Sun, 10 Nov 2024 14:26:37 +0000
Subject: [PATCH] Upload files to "/"
---
Makefile | 2 +-
config.h | 6 +++---
img.c | 24 ++++++++++++------------
style.css | 20 ++++++++++++++++++++
4 files changed, 36 insertions(+), 16 deletions(-)
create mode 100644 style.css
diff --git a/Makefile b/Makefile
index 872e518..0e29fa3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC?=cc
-CFLAGS?=-pedantic -Wall -Wextra
+CFLAGS?=-pedantic -Wall -Wextra -s -Os
all:
$(CC) $(CFLAGS) img.c -o 8img
diff --git a/config.h b/config.h
index 75a4dec..5a76a51 100644
--- a/config.h
+++ b/config.h
@@ -1,7 +1,7 @@
#define TITLE "8img gallery"
-#define POST_PER_PAGE 10
+#define POST_PER_PAGE 5
/* Absolute path to */
-#define ROOT "8img_dir"
+#define ROOT "."
#define DB ROOT"/db"
-#define CSS ROOT"/styles.css"
+#define CSS ROOT"/style.css"
diff --git a/img.c b/img.c
index 58dc405..c684b8e 100644
--- a/img.c
+++ b/img.c
@@ -239,13 +239,13 @@ 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", CSS, TITLE);
+ fprintf(fp, "\n\n\n%s\n\n\n", CSS, TITLE);
/* Tags */
- fputs("\n\n [all] ", fp);
+ fputs("\n [all] ", fp);
for (size_t i = 0; i < ut.size; i++)
- fprintf(fp, " [%s] ", ut.tags[i], ut.tags[i]);
- fputs("
\n\n", fp);
+ fprintf(fp, " [%s] ", ut.tags[i], ut.tags[i]);
+ fputs("\n
\n", fp);
/* Images */
size_t images = 0;
@@ -264,11 +264,11 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
}
}
- fprintf(fp, "
\n", p->filename, p->filename, p->filename);
+ fprintf(fp, "
", 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);
+ fputs("\n
\n", fp);
p = i;
images++;
@@ -279,10 +279,10 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
for (size_t i = 0; i <= pages; i++) {
if (i == 0) {
if (i == page)
- fprintf(fp, "(0) ", file);
+ fprintf(fp, " ", file);
else
- fprintf(fp, "[0] ", file);
+ fprintf(fp, " ", file);
}
else {
@@ -290,15 +290,15 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
snprintf(new_path, sizeof(new_path), "%s-%zu.html", file, i);
if (i == page)
- fprintf(fp, "(%zu) ", new_path, i);
+ fprintf(fp, "", new_path, i);
else
- fprintf(fp, "[%zu] ", new_path, i);
+ fprintf(fp, "", new_path, i);
}
}
- fprintf(fp, "\n");
+ fprintf(fp, "\n\n\n\n");
return p;
}
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..18a1303
--- /dev/null
+++ b/style.css
@@ -0,0 +1,20 @@
+body { background-color: #1d2021; }
+
+/* Links */
+a { text-decoration: none; }
+#tags { color: 8ec07c;}
+#pager { color: #b16286; }
+#alltags { color: #83a598; }
+
+#bar {
+ width: 100%;
+ height: 10px;
+ background-color: #ebdbb2;
+}
+
+img {
+ height: auto;
+ width: auto;
+ max-width: 50%;
+ max-height: 50%;
+}