forked from grafana.jool/grafana-jool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
472 B
22 lines
472 B
package imguploader
|
|
|
|
import (
|
|
"context"
|
|
"path"
|
|
"path/filepath"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
type LocalUploader struct {
|
|
}
|
|
|
|
func (u *LocalUploader) Upload(ctx context.Context, imageOnDiskPath string) (string, error) {
|
|
filename := filepath.Base(imageOnDiskPath)
|
|
image_url := setting.ToAbsUrl(path.Join("public/img/attachments", filename))
|
|
return image_url, nil
|
|
}
|
|
|
|
func NewLocalImageUploader() (*LocalUploader, error) {
|
|
return &LocalUploader{}, nil
|
|
}
|
|
|