wp_constrain_dimensions

FUNCTION wp-includes\media.php (ligne 398) github
Filters the value of the attachment's image tag class attribute.

Paramètres

Entrée :
$current_width, $current_height, $max_width = 0, $max_height = 0
Sortie :
@param string       $class CSS class name or space-separated list of classes.
@param int          $id    Attachment ID.
@param string       $align Part of the class name for aligning the image.
@param string|int[] $size  Requested image size. Can be any registered image size name, or
@param string       $html  HTML content for the image.
@param int          $id    Attachment ID.
@param string       $alt   Image description for the alt attribute.
@param string       $title Image description for the title attribute.
@param string       $align Part of the class name for aligning the image.
@param string|int[] $size  Requested image size. Can be any registered image size name, or
@param int $current_width  Current width of the image.
@param int $current_height Current height of the image.
@param int $max_width      Optional. Max width in pixels to constrain to. Default 0.
@param int $max_height     Optional. Max height in pixels to constrain to. Default 0.
@return int[] {

Utilisation

// Utilisation de la fonction wp_constrain_dimensions
$result = wp_constrain_dimensions($current_width, $current_height, $max_width = 0, $max_height = 0);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...