mirror of
https://github.com/SphericalKat/medium.rip.git
synced 2026-10-21 01:34:22 +00:00
feat: add opengraph and twitter previews
Signed-off-by: Sphericalkat <amolele@gmail.com>
This commit is contained in:
1 parent
c628ee7d6a
commit
3837d07495
3 files changed
+58
-14
No files matched your search
@@ -40,19 +40,7 @@ func (i *Image) width() int64 {
|
||||
}
|
||||
|
||||
func (i *Image) src() string {
|
||||
return fmt.Sprintf("%s/%d/%d/%s", IMAGE_HOST, i.width(), i.height(), i.ID)
|
||||
}
|
||||
|
||||
func (i *Image) height() int64 {
|
||||
if i.OriginalWidth > MAX_WIDTH {
|
||||
return i.OriginalHeight * int64(i.ratio())
|
||||
} else {
|
||||
return i.OriginalHeight
|
||||
}
|
||||
}
|
||||
|
||||
func (i *Image) ratio() float32 {
|
||||
return float32(MAX_WIDTH) / float32(i.OriginalWidth)
|
||||
return fmt.Sprintf("https://miro.medium.com/v2/resize:fit:1200/%s", i.ID)
|
||||
}
|
||||
|
||||
func ConvertParagraphs(paragraphs []entities.Paragraph) string {
|
||||
|
||||
Reference in new issue
Block a user