image_style_path_token
function image_style_path_token
image_style_path_token($style_name, $uri)
Generates a token to protect an image style derivative.
This prevents unauthorized generation of an image style derivative, which can be costly both in CPU time and disk space.
Parameters
$style_name: The name of the image style.
$uri: The URI of the image for this style, for example as returned by image_style_path().
Return value
An eight-character token which can be used to protect image style derivatives against denial-of-service attacks.
File
- modules/image/image.module, line 1076
- Exposes global functionality for creating image styles.
Code
function image_style_path_token($style_name, $uri) { // Return the first eight characters. return substr(drupal_hmac_base64($style_name . ':' . $uri, drupal_get_private_key() . drupal_get_hash_salt()), 0, 8); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.module/function/image_style_path_token/7.x