mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 11:44:26 -06:00
23 lines
472 B
Go
23 lines
472 B
Go
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
|
|
}
|