feature(thumbnails): add the ability to define custom image processors (#7409)
* feature(thumbnails): add the ability to define custom image processors * fix(ci): add exported member comment * docs(thumbnails): mention processors in readme * fix: codacy and code review feedback * fix: thumbnail readme markdown Co-authored-by: Martin <github@diemattels.at> --------- Co-authored-by: Martin <github@diemattels.at>
This commit is contained in:
@@ -36,6 +36,8 @@ type ThumbnailRequest struct {
|
||||
Height int32
|
||||
// In case of a public share the public link token.
|
||||
PublicLinkToken string
|
||||
// Indicates which image processor to use
|
||||
Processor string
|
||||
// The Identifier from the requested URL
|
||||
Identifier string
|
||||
}
|
||||
@@ -73,6 +75,7 @@ func ParseThumbnailRequest(r *http.Request) (*ThumbnailRequest, error) {
|
||||
Extension: filepath.Ext(fp),
|
||||
Width: int32(width),
|
||||
Height: int32(height),
|
||||
Processor: q.Get("processor"),
|
||||
PublicLinkToken: chi.URLParam(r, "token"),
|
||||
Identifier: id,
|
||||
}, nil
|
||||
|
||||
@@ -243,6 +243,7 @@ func (g Webdav) SpacesThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
ThumbnailType: extensionToThumbnailType(strings.TrimLeft(tr.Extension, ".")),
|
||||
Width: tr.Width,
|
||||
Height: tr.Height,
|
||||
Processor: tr.Processor,
|
||||
Source: &thumbnailssvc.GetThumbnailRequest_Cs3Source{
|
||||
Cs3Source: &thumbnailsmsg.CS3Source{
|
||||
Path: fullPath,
|
||||
@@ -335,6 +336,7 @@ func (g Webdav) Thumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
ThumbnailType: extensionToThumbnailType(strings.TrimLeft(tr.Extension, ".")),
|
||||
Width: tr.Width,
|
||||
Height: tr.Height,
|
||||
Processor: tr.Processor,
|
||||
Source: &thumbnailssvc.GetThumbnailRequest_Cs3Source{
|
||||
Cs3Source: &thumbnailsmsg.CS3Source{
|
||||
Path: fullPath,
|
||||
@@ -375,6 +377,7 @@ func (g Webdav) PublicThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
ThumbnailType: extensionToThumbnailType(strings.TrimLeft(tr.Extension, ".")),
|
||||
Width: tr.Width,
|
||||
Height: tr.Height,
|
||||
Processor: tr.Processor,
|
||||
Source: &thumbnailssvc.GetThumbnailRequest_WebdavSource{
|
||||
WebdavSource: &thumbnailsmsg.WebdavSource{
|
||||
Url: g.config.OcisPublicURL + r.URL.RequestURI(),
|
||||
@@ -416,6 +419,7 @@ func (g Webdav) PublicThumbnailHead(w http.ResponseWriter, r *http.Request) {
|
||||
ThumbnailType: extensionToThumbnailType(strings.TrimLeft(tr.Extension, ".")),
|
||||
Width: tr.Width,
|
||||
Height: tr.Height,
|
||||
Processor: tr.Processor,
|
||||
Source: &thumbnailssvc.GetThumbnailRequest_WebdavSource{
|
||||
WebdavSource: &thumbnailsmsg.WebdavSource{
|
||||
Url: g.config.OcisPublicURL + r.URL.RequestURI(),
|
||||
|
||||
Reference in New Issue
Block a user