钩子文档

wp_image_maybe_exif_rotate

💡 云策文档标注

概述

wp_image_maybe_exif_rotate 是一个 WordPress 过滤器,用于在旋转图像前修正或阻止基于 EXIF 方向的旋转操作。它允许开发者干预图像处理中的方向调整。

关键要点

  • 过滤器名称:wp_image_maybe_exif_rotate
  • 参数:$orientation(整数,从图像文件获取的 EXIF 方向值)和 $file(字符串,图像文件路径)
  • 用途:在 WP_Image_Editor::maybe_exif_rotate() 方法中调用,用于检查 JPEG 图像的 EXIF 方向标签并在需要时旋转图像
  • 引入版本:WordPress 5.3.0

📄 原文内容

Filters the $orientation value to correct it before rotating or to prevent rotating the image.

Parameters

$orientationint
EXIF Orientation value as retrieved from the image file.
$filestring
Path to the image file.

Source

$orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file );

Changelog

Version Description
5.3.0 Introduced.