XWIKI-9387: ImagePlugin does not shrink when FS attachments are enabled
Cherry picked from 7387c95b143af65338b6ff25c696cc1d41d447e5 and modified to pass older checkstyle.
Sorry Denis.