diff --git a/built-in/admin/post-options-modal.tpl b/built-in/admin/post-options-modal.tpl index bfc7c337..57a560a4 100644 --- a/built-in/admin/post-options-modal.tpl +++ b/built-in/admin/post-options-modal.tpl @@ -13,7 +13,7 @@
- {{shared.post.Image}} Remove + {{shared.post.Image}}No image Remove
diff --git a/built-in/admin/settings.html b/built-in/admin/settings.html index 9995bc44..8f7c3942 100644 --- a/built-in/admin/settings.html +++ b/built-in/admin/settings.html @@ -33,13 +33,13 @@

Blog

- +
- {{shared.blog.Cover}} + {{shared.blog.Cover}}No image
@@ -62,13 +62,13 @@

User {{shared.user.Name}}

- {{shared.user.Image}} + {{shared.user.Image}}No image
- {{shared.user.Cover}} + {{shared.user.Cover}}No image
diff --git a/built-in/public/images/no-image.png b/built-in/public/images/no-image.png new file mode 100644 index 00000000..9f750a03 Binary files /dev/null and b/built-in/public/images/no-image.png differ diff --git a/server/admin.go b/server/admin.go index 5efdb3de..0e4ed9f3 100644 --- a/server/admin.go +++ b/server/admin.go @@ -365,7 +365,11 @@ func apiUploadHandler(w http.ResponseWriter, r *http.Request, _ map[string]strin http.Error(w, err.Error(), http.StatusInternalServerError) return } - allFilePaths = append(allFilePaths, strings.Replace(dst.Name(), filenames.ContentFilepath, "", 1)) + // Rewrite to file path on server + filePath = strings.Replace(dst.Name(), filenames.ImagesFilepath, "/images", 1) + // Make sure to always use "/" as path separator (to make a valid url that we can use on the blog) + filePath = filepath.ToSlash(filePath) + allFilePaths = append(allFilePaths, filePath) } json, err := json.Marshal(allFilePaths) if err != nil { @@ -397,6 +401,8 @@ func apiImagesHandler(w http.ResponseWriter, r *http.Request, params map[string] if !info.IsDir() && (strings.EqualFold(filepath.Ext(filePath), ".jpg") || strings.EqualFold(filepath.Ext(filePath), ".jpeg") || strings.EqualFold(filepath.Ext(filePath), ".gif") || strings.EqualFold(filepath.Ext(filePath), ".png") || strings.EqualFold(filepath.Ext(filePath), ".svg")) { // Rewrite to file path on server filePath = strings.Replace(filePath, filenames.ImagesFilepath, "/images", 1) + // Make sure to always use "/" as path separator (to make a valid url that we can use on the blog) + filePath = filepath.ToSlash(filePath) // Prepend file to slice (thus reversing the order) images = append([]string{filePath}, images...) } diff --git a/watcher/watcher.go b/watcher/watcher.go index 81ce5c84..511e82da 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -68,7 +68,7 @@ func createWatcher(extensionsFunctions map[string]func() error) (*fsnotify.Watch } } case err := <-watcher.Errors: - log.Println("Error while watching theme directory.", err) + log.Println("Error while watching directory:", err) } } }()