It would be nice if the changes to image fields would also be reflected in the diff screen.
But maybe images are not stored in revisions so it's not something you can do.

Comments

TimelessDomain’s picture

idk if images are purged from the filesystem upon node deletion or revision, but i would assume that they are not. So the revision could call upon the images still OR maybe (if they are deleted) this module could move them into a new directory upon revision. The diff should show at a minimum that the field has changed values, but the image saving should not be hard to setup. The revision deletion module http://drupal.org/project/revision_deletion will be important with image diff support (since it would need to delete files associated with revisions).

hanoii’s picture

Just noting something I did by overriding a diff theme function.

This is for 6.x but probably works for 7.x with some adjustments.

It's also a work in progress, this is just something custom I did that I thought I might share:

Note, I am using an imagecache preset, but it can use just theme('image'), you need to remove the preset though if you use that instead.


/**
 * Theme function for a content line in the diff.
 */
function THEME_diff_content_line($line) {
  $line = filter_xss($line);
  $filespath = str_replace('/', '\/', file_create_path());
  if (preg_match("/($filespath.*)(.jpg|.png|.gif|.bmp)/i", $line, $matches)) {
    unset($matches[0]);
    $img = implode('', $matches);
    $output = '<div>' . theme('imagecache', '100x200', $img, $img, $img) . '</div>';
  }
  else {
    $output = '<div>'. $line .'</div>';
  }

  return $output;
}
tecjam’s picture

Priority: Normal » Major

I think this should be a major request.

For multi-user sites it would be extremely important to know when images were changed / removed / added.
Moving the files after a revision would be helpful, but not necessarily essential. For example one could move removed files into a sub_folder or simply prepend something to the file name. Of course then the db table 'file_managed' would need to update the filename aswell as the uri fields.

I tried the above code in my themes template.php file - I do use drupal 7 - I changed the output line for correct image cache formatting in d7, but it doesn't work at all when images are changed / added / deleted ..

I use the default thumbnail preset as it is not possible to delete this.

/**
* Theme function for a content line in the diff.
*/
function YOURTHEME_diff_content_line($line) {
  $line = filter_xss($line);
  $filespath = str_replace('/', '\/', file_create_path());
  if (preg_match("/($filespath.*)(.jpg|.png|.gif|.bmp)/i", $line, $matches)) {
    unset($matches[0]);
    $img = implode('', $matches);
    $output = '<div>' . image_style_url('thumbnail', $img) . '</div>';
  }
  else {
    $output = '<div>'. $line .'</div>';
  }

  return $output;
}
mitchell’s picture

Title: Image diff support » File / Image Field Diff Integration
Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Active » Fixed

This is fixed in 7.x-3.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.