[WordPress] 外掛分享: Exif Details

WordPress 外掛 Exif Details 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Exif Details」是 2020-05-04 上架。
  • 目前有 300 個安裝啟用數。
  • 上一次更新是 2025-04-16,距離現在已有 17 天。
  • 外掛最低要求 WordPress 4.7 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 8.0 以上。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

katsushi-kawamori |

外掛標籤

exif | photos | media library |

內容簡介

取得媒體檔案的詳細 Exif 資訊。

資料選擇

檔案
EXIF
GPS

相關外掛

可以在以下外掛中使用此外掛所產生的標籤。
Exif標題。

特別感謝!測試資料提供者

sysbird

使用範例 1 和 3 的程式碼片段範例

如何使用過濾器和動作鉤子的範例程式碼片段

範例片段 1

/** ==================================================
* 範例片段 1
*
* 原始過濾器鉤子('exif_details_data'),當從元資料中擷取 Exif 並存儲時,會更改顯示方式。
* 以下改變了拍攝日期和時間的顯示方式。
*
* @param array $exifdatas exifdatas。
* @param int $id id。
*/
function exif_details_change( $exifdatas, $id ) {
if ( array_key_exists( 'DateTimeOriginal', $exifdatas ) ) {
$shooting_date = str_replace( ':', '-', substr( $exifdatas['DateTimeOriginal'], 0, 10 ) );
$shooting_time = substr( $exifdatas['DateTimeOriginal'], 10 );
$exifdatas['DateTimeOriginal'] = $shooting_date . $shooting_time;
}
return $exifdatas;
}
add_filter( 'exif_details_data', 'exif_details_change', 10, 2 );

範例片段 2

/** ==================================================
* 範例片段 2
*
* 擷取文章元資料,並將拍攝日期和時間添加到媒體頁面的標題中。
* 在函數中執行原始動作鉤子('exif_details_update')。
*
* @param array $title title。
* @param int $id id。
*/
function media_title( $title, $id ) {
$datetime = null;
if ( is_attachment() ) {
do_action( 'exif_details_update', $id );
$exifdatas = get_post_meta( $id, '_exif_details', true );
if ( ! empty( $exifdatas ) && array_key_exists( 'DateTimeOriginal', $exifdatas ) ) {
$datetime = '日期:' . $exifdatas['DateTimeOriginal'];
}
}
return $title . $datetime;
}
add_filter( 'the_title', 'media_title', 10, 2 );

範例片段 3

/** ==================================================
* 範例片段 3
*
* 新增媒體時,將處理過的資料插入標題。
* 使用原始動作鉤子('exif_details_update')和函數。
*
* @param array $metadata metadata。
* @param int $id id。
*/
function media_caption( $metadata, $id ) {
$mime_type = get_post_mime_type( $id );
if ( in_array( $mime_type, array( 'image/jpeg', 'image/tiff' ) ) ) {
do_action( 'exif_details_update', $id );
$exifdatas = get_post_meta( $id, '_exif_details', true );
if ( ! empty( $exifdatas ) ) {
$camera = null;
$f_number = null;
$s_speed = null;
$iso = null;
$date = null;
$googlemap = null;
if ( array_key_exists( 'Model', $exifdatas ) ) {
$camera = '相機:' . $exifdatas['Model'];
}
if ( array_key_exists( 'ApertureFNumber', $exifdatas ) ) {
$f_number = 'F值:' . $exifdatas['ApertureFNumber'];
}

原文外掛簡介

Get detailed Exif information about the media file.
Data Selection

FILE
EXIF
GPS

Sibling plugin

Can use the tags generated by this plugin in the following plugin.
Exif Caption.

Special Thanks! Test data provider

sysbird

Sample using snippet 1 & 3

Sample of how to use the filter hook and action hook

Sample snippet 1

/** ==================================================
* Sample snippet 1
*
* The original filter hook('exif_details_data'),
* which changes the display when retrieving an Exif and storing it in metadata.
* The following changes the display of the shooting date and time.
*
* @param array $exifdatas exifdatas.
* @param int $id id.
*/
function exif_details_change( $exifdatas, $id ) {
if ( array_key_exists( 'DateTimeOriginal', $exifdatas ) ) {
$shooting_date = str_replace( ':', '-', substr( $exifdatas['DateTimeOriginal'], 0, 10 ) );
$shooting_time = substr( $exifdatas['DateTimeOriginal'], 10 );
$exifdatas['DateTimeOriginal'] = $shooting_date . $shooting_time;
}
return $exifdatas;
}
add_filter( 'exif_details_data', 'exif_details_change', 10, 2 );

Sample snippet 2

/** ==================================================
* Sample snippet 2
*
* Retrieve the post metadata and add the date and time of the shooting to the title of the media page.
* Execute the original action hook('exif_details_update') in the function.
*
* @param array $title title.
* @param int $id id.
*/
function media_title( $title, $id ) {
$datetime = null;
if ( is_attachment() ) {
do_action( 'exif_details_update', $id );
$exifdatas = get_post_meta( $id, '_exif_details', true );
if ( ! empty( $exifdatas ) && array_key_exists( 'DateTimeOriginal', $exifdatas ) ) {
$datetime = ' Date:' . $exifdatas['DateTimeOriginal'];
}
}
return $title . $datetime;
}
add_filter( 'the_title', 'media_title', 10, 2 );

Sample snippet 3

/** ==================================================
* Sample snippet 3
*
* When adding new media, insert the processed data into the caption.
* Use the original action hook ('exif_details_update') with function.
*
* @param array $metadata metadata.
* @param int $id id.
*/
function media_caption( $metadata, $id ) {
$mime_type = get_post_mime_type( $id );
if ( in_array( $mime_type, array( 'image/jpeg', 'image/tiff' ) ) ) {
do_action( 'exif_details_update', $id );
$exifdatas = get_post_meta( $id, '_exif_details', true );
if ( ! empty( $exifdatas ) ) {
$camera = null;
$f_number = null;
$s_speed = null;
$iso = null;
$date = null;
$googlemap = null;
if ( array_key_exists( 'Model', $exifdatas ) ) {
$camera = 'Camera:' . $exifdatas['Model'];
}
if ( array_key_exists( 'ApertureFNumber', $exifdatas ) ) {
$f_number = 'F-number:' . $exifdatas['ApertureFNumber'];
}
if ( array_key_exists( 'ExposureTime', $exifdatas ) ) {
$s_speed = 'Shutter speed:' . $exifdatas['ExposureTime'];
}
if ( array_key_exists( 'ISOSpeedRatings', $exifdatas ) ) {
$isodata = json_decode( $exifdatas['ISOSpeedRatings'] );
if ( is_array( $isodata ) ) {
$iso = 'ISO:' . $isodata[0];
} else {
$iso = 'ISO:' . $isodata;
}
}
if ( array_key_exists( 'DateTimeOriginal', $exifdatas ) ) {
$date = 'Date:' . $exifdatas['DateTimeOriginal'];
}
if ( array_key_exists( 'latitude_dd', $exifdatas ) && array_key_exists( 'longtitude_dd', $exifdatas ) ) {
$googlemap = 'Google Map';
}
$caption = sprintf( '%1$s %2$s %3$s %4$s %5$s %6$s', $camera, $f_number, $s_speed, $iso, $date, $googlemap );
$caption = rtrim( $caption );
$caption = preg_replace( '/\s(?=\s)/', '', $caption );
$media_post = array(
'ID' => $id,
'post_excerpt' => $caption,
);
wp_update_post( $media_post );
}
}
return $metadata;
}
add_filter( 'wp_generate_attachment_metadata', 'media_caption', 10, 2 );

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Exif Details」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.00 | 1.01 | 1.02 | 1.03 | 1.04 | 1.05 | 1.06 | 1.07 | 1.08 | 1.09 | 1.10 | trunk |

延伸相關外掛(你可能也想知道)

  • FancyBox for WordPress 》本外掛能讓FancyBox輕鬆整合到您的部落格:上傳,啟用,完成。您也能選擇進行更多的設置。, 您幾乎可以對Fancybox lightbox的所有屬性進行自定義:邊框、邊緣...。
  • Meks Simple Flickr Widget 》這個 WordPress 外掛可以快速地將你的 Flickr 照片顯示於 Widget 中,且不需要進行授權(只需提供你的使用者 ID)。, 功能, , 無需授權(只需提供使用者 ID)...。
  • Unite Gallery Lite 》Unite Gallery 是一種用於 WordPress 的全功能圖片和視頻圖庫。, 它基於 unite gallery javascript 版本,並具有非常強大直觀的 WordPress 管理員,以方便您...。
  • Pixabay Images 》Pixabay Images 是一款 WordPress 外掛,讓您能夠從 Pixabay 中選擇 CC0 公有領域圖片,在部落格上輕鬆插入。這些圖片可安全使用,且不需要歸屬或連結回原始...。
  • Image Optimizer by 10web – Image Optimizer and Compression plugin 》10Web 的圖片最佳化外掛, 使用手冊, 您的網站上有大量高解析度的圖片嗎?圖片可能會使網頁讀取時間增加,令您的訪客感到沮喪。優化圖片可以加速您的網站,同...。
  • Free Assets Library – Openverse/Pixabay 600+ Million Images 》免費資產庫是一款提供 6 億張免費圖片且已下載 75,000+ 次的前 WordPress 外掛 🚀, 您可以簡單地從以下 600+ 萬張圖片中搜尋您最喜愛的圖片:, , Openvers...。
  • WooCommerce Product Image Flipper 》這個外掛非常簡單,它可以在商品檔案上新增第二個產品縮圖,當你懸停在主要產品圖像上時,這個縮圖就會顯示出來。, 如果你想在商品檔案上顯示多張圖片,或者...。
  • User Photo 》這個外掛允許用戶透過「您的個人資料」頁面將個人照片與帳戶相關聯。管理員可以透過訪問「編輯使用者」頁面為用戶添加個人照片。上傳的圖像會被調整大小以符...。
  • Widgets for Social Photo Feed 》**總結:**, 透過我們的反應靈敏Instagram Feed Widgets,免費在2分鐘內展示你的Instagram動態。這款免費外掛讓在你的網站任何地方整合Instagram小部件變得輕...。
  • Featured Content Gallery 》Featured Content Gallery 是一個自動化、完全可自訂的旋轉圖片庫外掛,可以在 WordPress 網站中的任何位置建立。您可以選擇自己的圖像和顯示的分類、頁面或...。
  • Social Photo Fetcher 》Social Photo Fetcher(以前稱為「Facebook Photo Fetcher」)使您可以從 Facebook 相簿中快速輕鬆地生成 WordPress 照片庫。, 靈感來自於Fotobook,但其方法...。
  • WP-SimpleViewer 》WP-SimpleViewer外掛讓你能夠輕鬆地在WordPress中創建SimpleViewer圖庫。 SimpleViewer是一款免費、可自定義的Flash圖片庫。圖片和說明文字可以從WordPress媒...。
  • WP Photo Sphere 》WP Photo Sphere 是一個外掛,允許您顯示 360×180 度全景照片。使用 WP Photo Sphere,您的訪客不需要安裝任何插件即可瀏覽您的全景照片。, WP Photo Sp...。
  • Cincopa video and media plug-in 》無需多個 WordPress 外掛來管理您的媒體,Cincopa 是您所有媒體需求中唯一需要的外掛。使用 Cincopa 輕鬆地添加視頻、照片庫、幻燈片、音樂和播放列表等等。...。
  • Exifography 》Exifography(前稱Thesography)為WordPress上傳的圖像顯示EXIF數據。它利用WordPress自己儲存 EXIF欄位的功能,並在圖片上傳時將緯度、經度和快門 EXIF匯入...。

文章
Filter
Apply Filters
Mastodon