Scale profile pictures to a consistent size
This commit is contained in:
parent
bb0e7fa2fc
commit
3d01fc55f4
|
@ -118,6 +118,9 @@ func UploadPhoto(cfg UploadConfig) (string, string, error) {
|
||||||
return filename, "", nil
|
return filename, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scale profile photos down into consistent sizes.
|
||||||
|
croppedImg = Scale(croppedImg, image.Rect(0, 0, config.ProfilePhotoWidth, config.ProfilePhotoWidth), draw.ApproxBiLinear)
|
||||||
|
|
||||||
// Write that to disk, too.
|
// Write that to disk, too.
|
||||||
log.Debug("Writing cropped image to disk: %s", cropFilename)
|
log.Debug("Writing cropped image to disk: %s", cropFilename)
|
||||||
if err := ToDisk(cropFilename, extension, croppedImg, &cfg); err != nil {
|
if err := ToDisk(cropFilename, extension, croppedImg, &cfg); err != nil {
|
||||||
|
@ -218,6 +221,9 @@ func ReCrop(filename string, x, y, w, h int) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scale profile photos down into consistent sizes.
|
||||||
|
croppedImg = Scale(croppedImg, image.Rect(0, 0, config.ProfilePhotoWidth, config.ProfilePhotoWidth), draw.ApproxBiLinear)
|
||||||
|
|
||||||
// Write it.
|
// Write it.
|
||||||
err = ToDisk(cropFilename, ext, croppedImg, nil)
|
err = ToDisk(cropFilename, ext, croppedImg, nil)
|
||||||
return cropFilename, err
|
return cropFilename, err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user