Photos: Update file mod time when changing image orientation #464

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-03-22 17:41:07 +01:00
parent 5982911e4c
commit e9d96e8849
2 changed files with 3 additions and 3 deletions

View file

@ -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")

View file

@ -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