Photos: Update file mod time when changing image orientation #464
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
5982911e4c
commit
e9d96e8849
2 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ func ChangeFileOrientation(router *gin.RouterGroup) {
|
|||
|
||||
// Abort in read-only mode or if editing is disabled.
|
||||
if conf.ReadOnly() || !conf.Settings().Features.Edit {
|
||||
Abort(c, http.StatusForbidden, i18n.ErrReadOnly)
|
||||
c.AbortWithStatusJSON(http.StatusForbidden, i18n.NewResponse(http.StatusForbidden, i18n.ErrReadOnly))
|
||||
return
|
||||
} else if conf.DisableExifTool() {
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, "exiftool is disabled")
|
||||
|
|
|
@ -160,11 +160,11 @@ func (m *MediaFile) CreateThumbnails(thumbPath string, force bool) (err error) {
|
|||
func (m *MediaFile) ChangeOrientation(val int) (err error) {
|
||||
if !m.IsPreviewImage() {
|
||||
// Skip.
|
||||
return fmt.Errorf("not a preview image")
|
||||
return fmt.Errorf("orientation can currently only be changed for jpeg and png files")
|
||||
}
|
||||
|
||||
cnf := Config()
|
||||
cmd := exec.Command(cnf.ExifToolBin(), "-overwrite_original", "-P", "-n", "-ModifyDate<FileModifyDate", "-Orientation="+strconv.Itoa(val), m.FileName())
|
||||
cmd := exec.Command(cnf.ExifToolBin(), "-overwrite_original", "-n", "-Orientation="+strconv.Itoa(val), m.FileName())
|
||||
|
||||
// Fetch command output.
|
||||
var out bytes.Buffer
|
||||
|
|
Loading…
Reference in a new issue