diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index 463d1ba..877a71e 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -151,6 +151,7 @@ func CreateThread(c *gin.Context) { path := filepath.Join( Utils.UPLOADS_DIR_PATH, strconv.Itoa(postID), + "o", strconv.Itoa(fileID)+"."+file.Ext, ) err = c.SaveUploadedFile(fileInRequest, path) @@ -247,6 +248,7 @@ func UpdateThread(c *gin.Context) { path := filepath.Join( Utils.UPLOADS_DIR_PATH, strconv.Itoa(threadID), + "o", strconv.Itoa(fileID)+"."+file.Ext, ) err = c.SaveUploadedFile(fileInRequest, path) diff --git a/templates/index.html b/templates/index.html index e4d6427..aa12f20 100644 --- a/templates/index.html +++ b/templates/index.html @@ -24,7 +24,7 @@ {{ if gt $length 0 }} {{ $FirstFile := index $Post.Files 0 }} Uploaded picture diff --git a/templates/thread.html b/templates/thread.html index 85d4011..ee2db63 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -31,9 +31,9 @@
{{ range $File := $Post.Files }}
- + Uploaded picture diff --git a/utils/utils.go b/utils/utils.go index 0e1da55..9b29500 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -44,6 +44,17 @@ func CreateThreadFolder(postID int) error { return err } + originalsFolder := filepath.Join(threadDirPath, "o") + err = os.Mkdir(originalsFolder, 0755) + if err != nil { + return err + } + thumbnailsFolder := filepath.Join(threadDirPath, "t") + err = os.Mkdir(thumbnailsFolder, 0755) + if err != nil { + return err + } + return nil }