Closed seth-shaw-asu closed 2 years ago
As suspected, it appears these can be fixed by using PNG instead of Jpeg for the thumbnail. See https://repo-dev.aws.lib.asu.edu/media/1540.
Once we adjust the action to use PNG, the following script should address the known problems:
$accountSwitcher = Drupal::service('account_switcher');
$accountSwitcher->switchTo(\Drupal::entityTypeManager()->getStorage('user')->load(1));
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple([
#572
'160934',
'161121',
'161174',
'161214',
'161220',
'161222',
#560
'167047',
'167048',
'167049',
'167050',
'167057',
]);
$iu = \Drupal::service('islandora.utils');
$tm = $iu->getTermForUri('http://pcdm.org/use#ThumbnailImage');
$dmf = \Drupal::entityTypeManager()->getStorage('action')->load('delete_media_and_file');
$igtfof = \Drupal::entityTypeManager()->getStorage('action')->load('image_generate_a_thumbnail_from_an_original_file');
foreach ($nodes as $node) {
$thumnail_media = $iu->getMediaWithTerm($node, $tm);
$dmf->execute([$thumbnail_media]);
$igtfof->execute([$node]);
}
You would think that script would work, but something odd is happening where the entities provided to the delete media and files action don't appear to have the language function, which all objects with the EntityInterface have.
Deleted and regenerated using the web-interface with the new PNG settings and Crayfish update.
Similar to #565, we should have sensible thumbnail generation settings that avoid providing black rectangle thumbnails.
Examples found while working on #563: