mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 01:04:52 +08:00
Add option to auto fix jpg orientation
This commit is contained in:
@@ -16,19 +16,22 @@ type VolumeServer struct {
|
||||
rack string
|
||||
whiteList []string
|
||||
store *storage.Store
|
||||
|
||||
FixJpgOrientation bool
|
||||
}
|
||||
|
||||
func NewVolumeServer(r *http.ServeMux, ip string, port int, publicIp string, folders []string, maxCounts []int,
|
||||
masterNode string, pulseSeconds int,
|
||||
dataCenter string, rack string,
|
||||
whiteList []string) *VolumeServer {
|
||||
whiteList []string, fixJpgOrientation bool) *VolumeServer {
|
||||
publicUrl := publicIp + ":" + strconv.Itoa(port)
|
||||
vs := &VolumeServer{
|
||||
masterNode: masterNode,
|
||||
pulseSeconds: pulseSeconds,
|
||||
dataCenter: dataCenter,
|
||||
rack: rack,
|
||||
whiteList: whiteList,
|
||||
masterNode: masterNode,
|
||||
pulseSeconds: pulseSeconds,
|
||||
dataCenter: dataCenter,
|
||||
rack: rack,
|
||||
whiteList: whiteList,
|
||||
FixJpgOrientation: fixJpgOrientation,
|
||||
}
|
||||
vs.store = storage.NewStore(port, ip, publicUrl, folders, maxCounts)
|
||||
|
||||
|
@@ -156,6 +156,10 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if vs.FixJpgOrientation && strings.HasSuffix(string(needle.Name), ".jpg") {
|
||||
needle.Data = images.FixJpgOrientation(needle.Data)
|
||||
}
|
||||
|
||||
ret := operation.UploadResult{}
|
||||
size, errorStatus := topology.ReplicatedWrite(vs.masterNode, vs.store, volumeId, needle, r)
|
||||
if errorStatus == "" {
|
||||
|
Reference in New Issue
Block a user