Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295826

ImageStyle::createDerivative should return fail if one of the style's effects fails

$
0
0

Follow-up to #2359443: Allow creating image derivatives from an Image object

Problem/Motivation

From #2359443-17: Allow creating image derivatives from an Image object:

+++ b/core/modules/image/src/Entity/ImageStyle.php
@@ -309,6 +320,23 @@ public function createDerivative($original_uri, $derivative_uri) {
+    // Apply the effects to the image object.
+    foreach ($this->getEffects() as $effect) {
+      $effect->applyEffect($image);
+    }
...
+    return TRUE;

Only now I see this crap. So ImageEffectInterface::applyEffect() does return a success flag but we are not using it here. We just return TRUE regardless if the effects were applied correct. Is there a good reason for this? I don't remember. If there's a reason, we need to document it, otherwise we need something like:

<?php
if (!$effect->applyEffect($image)) {
  return FALSE;
}
?>

Proposed resolution

Remaining tasks

  • discuss what to do
  • write a patch

User interface changes

API changes


Viewing all articles
Browse latest Browse all 295826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>