/** * {@inheritdoc} */ public function preSave() { parent::preSave(); $width = $this->width; $height = $this->height; // Determine the dimensions if necessary. if (empty($width) || empty($height)) { $image = \Drupal::service('image.factory')->get($this->entity->getFileUri()); if ($image->isValid()) { $this->width = $image->getWidth(); $this->height = $image->getHeight(); } } }
/** * {@inheritdoc} */ public function preSave() { parent::preSave(); }