外掛說明
註冊媒體檔案至媒體庫
- 變更 EXIF 資訊的日期/時間。
系列外掛
使用篩選器勾點示範
- 程式碼片段範例
/** ==================================================
* Sample snippet for Upload Media Exif Date
*
* The original filter hook('umed_postdate'),
* Get the date and time from the file name when the date and time cannot be read from the EXIF.
*
* @param string $postdate postdate.
* @param string $filename filename.
*/
function umed_postdate_from_filename( $postdate, $filename ) {
/* Sample for 20191120_183022.jpg */
$year = substr( $filename, 0, 4 );
$month = substr( $filename, 4, 2 );
$day = substr( $filename, 6, 2 );
$hour = substr( $filename, 9, 2 );
$minute = substr( $filename, 11, 2 );
$second = substr( $filename, 13, 2 );
$postdate = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minute . ':' . $second;
return $postdate;
}
add_filter( 'umed_postdate', 'umed_postdate_from_filename', 10, 2 );
安裝方式
- 將外掛安裝套件 ZIP 壓縮檔解壓縮所得的
zip-from-media
資料夾上傳至網站的/wp-content/plugins/
目錄。 - 在 WordPress 管理後台的 [外掛] 選單中啟用外掛。
常見問題集
無
使用者評論
2024 年 4 月 26 日
いちいち日付を書き直す必要がなく、年月でフォルダ分けできるのでとても助かっていて今まで当たり前のように利用させていただいていました。
最近アップロードするとファイル名に2バイト文字が含まれていることが問題なのか、特定のカメラの写真をRAW編集して現像したJpeg写真をアップするとタイトルがアップ後に「?????」となる問題が発生しています。日付はちゃんと取得してくれます。
何かのプラグインとの競合や、私の特定の環境(Wordpressは最新版ですがプラグインは多い)の問題かもしれませんがそうなる場合があることを書かせていただきました。もしかしたらお門違いかもしれません。プラグイン自体はとても素晴らしいものです
2021 年 3 月 23 日
It just works, does what it says it does. great job
參與者及開發者
變更記錄
[1.08] 2025/04/24
- Fix – Loading the management screen.
[1.07] 2024/03/05
- Fix – Changed file operations to WP_Filesystem.
1.06
Supported WordPress 6.4.
PHP 8.0 is now required.
1.05
Fixed filter hook(‘umed_postdate’).
1.04
Add filter hook(‘umed_postdate’).
1.03
Supported WordPress 5.6.
1.02
Fixed problem of metadata.
1.01
Fixed a problem with moving files.
1.00
Initial release.