- Have got upload images appearing in the post list - Allowed for deleting uploads - Allowed for seeing the upload progress - Fixed the setting of upload properties like the MIME type - Removed the stripe exif logic with just re-encoding PNGs and JPEGs by loading them and saving them
22 lines
599 B
Go
22 lines
599 B
Go
package markdown
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/PuerkitoBio/goquery"
|
|
)
|
|
|
|
func rewriteImgSrc(transform func(ctx context.Context, in string) string) htmlTransform {
|
|
return func(ctx context.Context, dom *goquery.Document) error {
|
|
dom.Find("img").Each(func(i int, s *goquery.Selection) {
|
|
s.SetAttr("src", transform(ctx, s.AttrOr("src", "")))
|
|
})
|
|
dom.Find("img").Each(func(i int, s *goquery.Selection) {
|
|
s.AddClass("img-fluid")
|
|
})
|
|
//SetAttr("style", "max-width: 200px;max-height: 200px;height: auto;")
|
|
//log.Printf("Rewritten image src: %s", s.AttrOr("style", ""))
|
|
return nil
|
|
}
|
|
}
|