diff --git a/internal/webserver/tpl/includes/author_info.tpl b/internal/webserver/tpl/includes/author_info.tpl
index 9c9b46a..ca78dbc 100644
--- a/internal/webserver/tpl/includes/author_info.tpl
+++ b/internal/webserver/tpl/includes/author_info.tpl
@@ -3,7 +3,7 @@
diff --git a/pkg/scraper/user.go b/pkg/scraper/user.go
index 609b9b9..f7a028c 100644
--- a/pkg/scraper/user.go
+++ b/pkg/scraper/user.go
@@ -10,6 +10,7 @@ import (
)
const DEFAULT_PROFILE_IMAGE_URL = "https://abs.twimg.com/sticky/default_profile_images/default_profile.png"
+const DEFAULT_PROFILE_IMAGE = "default_profile.png"
type UserID int64
type UserHandle string
@@ -244,3 +245,14 @@ func (u User) GetTinyProfileImageLocalPath() string {
return string(u.Handle) + "_profile_" + path.Base(u.GetTinyProfileImageUrl())
}
+
+// Compute a path that will actually contain an image on disk (relative to the Profile)
+// TODO: why there are so many functions that appear to do roughly the same thing?
+func (u User) GetProfileImageLocalPath() string {
+ if u.IsContentDownloaded || u.ProfileImageLocalPath == DEFAULT_PROFILE_IMAGE {
+ return fmt.Sprintf("/profile_images/%s", u.ProfileImageLocalPath)
+ }
+
+ r := regexp.MustCompile(`(\.\w{2,4})$`)
+ return fmt.Sprintf("/profile_images/%s", r.ReplaceAllString(u.ProfileImageLocalPath, "_normal$1"))
+}