1 image.module &image_style_add_allowed_uri($style_uri = NULL)

Add an image style URI to the allowlist.

When added to the allowlist, and image style will be generated immediately upon request. This function is usually called by the request that prints out the <img> tag with the image style in the src attribute. The allowlist is then loaded when serving the image if it needs to be generated. Image style requests that are not in the allowlist are throttled in image_style_deliver().


$style_uri: The full URI to the image that will be generated. e.g. public://styles/large/example.png.

Return value

array: The list of all images added to the allowlist this request. This list is returned by reference to allow the list to be modified.

See also





core/modules/image/image.module, line 1049
Exposes global functionality for creating image styles.


function &image_style_add_allowed_uri($style_uri = NULL) {
  $added_uris = &backdrop_static('image_style_allowed_uris', array());

  // It's likely that multiple images will be allowed during a single
  // request, so we only save this list once at the end of the request.
  if ($style_uri && empty($added_uris)) {

  if ($style_uri) {
    $added_uris[$style_uri] = TRUE;

  return $added_uris;