web-dev-qa-db-fra.com

Comment supprimer le jeton itok des URL des images?

Comment supprimer le jeton itok des URL des images?

J'ai trouvé un article en discutant, mais cela ne fonctionne que pour Drupal 7 ( https://www.drupal.org/node/1934498 ).

Certains articles expliquent pourquoi Drupal ajoute des jetons aux URL des images.

11
shi jack

Bien qu'il soit recommandé de conserver le paramètre itok, il est configurable.

Vous pouvez le supprimer de la sortie en utilisant le image.settings paramètre de configuration suppress_itok_output

  // The token query is added even if the
  // 'image.settings:allow_insecure_derivatives' configuration is TRUE, so
  // that the emitted links remain valid if it is changed back to the default
  // FALSE. However, sites which need to prevent the token query from being
  // emitted at all can additionally set the
  // 'image.settings:suppress_itok_output' configuration to TRUE to achieve
  // that (if both are set, the security token will neither be emitted in the
  // image derivative URL nor checked for in
  // \Drupal\image\ImageStyleInterface::deliver()).

https://api.drupal.org/api/drupal/core!modules!image!src!Entity!ImageStyle.php/function/ImageStyle%3A%3AbuildUrl/8.2.x

10
David Thomas

Mettez ceci dans votre settings.php (ou local.settings.php):

$config['image.settings']['suppress_itok_output'] = TRUE;
1
ssibal