Image Field Repair

Categories

Component ID

2920346

Component name

Image Field Repair

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

124

Component created

Component changed

Component body

Image Field Repair is a module that repairs image field values that are touched by issue #2644468: Multiple image upload breaks image dimensions.

That issue:

  • TL;DR: image dimensions, width and height, may be stored incorrectly for all but the 1st image on a multi-upload.
  • Is currently (early november 2017) still open, even though it has a reportedly working patch.
  • Does not currently provide an upgrade function (hook_update_N) even though comment #37 asks for it.
  • IMO, Comment #38 is too easy: a small site I am currently building had 1389 incorrect dimensions on 2316 images, not a number you would like to delete and upload again (certainly mot without my Duplicate Images project. that unfortunately still only exists for D7).

This module:

  • Repairs the corruption introduced by the above issue (or any other cause).
  • It does so by providing an admin form that upon submission starts a check and repair process.
  • The repairing is done using the batch API ...
  • ... In such a way that the file image_field_repair.inc can serve as upgrade path as is, that is, it follows the conventions of the hook_update_N() hook! and contains production ready code.

My goals with this module

  • I hope that the code of this module makes it to the patch as an upgrade hook, thereby making this module superfluous.
  • If the code does not end up in the patch, I hope that a small hook_update_N() will be added that shows a message about the possible corruption and refers to a page on drupal.org further describing the problem and solution (ie use this module).
  • Until the issue gets patched, this module will serve those who ran into the problem and want the resulting corruption fixed now.
  • Even though I did some development for the D8 image module, I hardly had any knowledge of the new D8 APIs, especially the entity and field API. So I also developed this module to get some experience with D8 module development.

Installation

As usual

Usage

After installing and enabling the module, go to Admin - Configuration - Media - Image Field Repair (admin/config/media/image_file_repair/dimensions) and press the "Start" button.

After having repaired your image fields you can uninstall and remove this module.