mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #1392 from yourchanges/master
Fix the bug of "http://xx/xx,xxx.PNG?width=100"
This commit is contained in:
commit
8a1baafcb3
|
@ -208,7 +208,9 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *needle.Needle, fileName string,
|
||||||
|
|
||||||
func conditionallyResizeImages(originalDataReaderSeeker io.ReadSeeker, ext string, r *http.Request) io.ReadSeeker {
|
func conditionallyResizeImages(originalDataReaderSeeker io.ReadSeeker, ext string, r *http.Request) io.ReadSeeker {
|
||||||
rs := originalDataReaderSeeker
|
rs := originalDataReaderSeeker
|
||||||
|
if len(ext) > 0 {
|
||||||
|
ext = strings.ToLower(ext)
|
||||||
|
}
|
||||||
width, height, mode, shouldResize := shouldResizeImages(ext, r)
|
width, height, mode, shouldResize := shouldResizeImages(ext, r)
|
||||||
if shouldResize {
|
if shouldResize {
|
||||||
rs, _, _ = images.Resized(ext, originalDataReaderSeeker, width, height, mode)
|
rs, _, _ = images.Resized(ext, originalDataReaderSeeker, width, height, mode)
|
||||||
|
@ -217,9 +219,6 @@ func conditionallyResizeImages(originalDataReaderSeeker io.ReadSeeker, ext strin
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldResizeImages(ext string, r *http.Request) (width, height int, mode string, shouldResize bool) {
|
func shouldResizeImages(ext string, r *http.Request) (width, height int, mode string, shouldResize bool) {
|
||||||
if len(ext) > 0 {
|
|
||||||
ext = strings.ToLower(ext)
|
|
||||||
}
|
|
||||||
if ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif" {
|
if ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif" {
|
||||||
if r.FormValue("width") != "" {
|
if r.FormValue("width") != "" {
|
||||||
width, _ = strconv.Atoi(r.FormValue("width"))
|
width, _ = strconv.Atoi(r.FormValue("width"))
|
||||||
|
|
Loading…
Reference in a new issue