[WordPress] 外掛分享: Media Auto Hash Rename

首頁外掛目錄 › Media Auto Hash Rename
WordPress 外掛 Media Auto Hash Rename 的封面圖片
80+
安裝啟用
★★★★★
5/5 分(1 則評價)
1681 天前
最後更新
問題解決
WordPress 4.0+ v1.0.1 上架:2019-03-29

內容簡介

Media Auto Hash Rename 可在檔案上傳時將任何檔案(可以根據檔案類型忽略特定的檔案副檔名)重新命名,使用獨特且低碰撞的雜湊標識。雜湊的字元和長度可以配置以獲得更低的碰撞率。

更多資訊請參閱我的網站。

此外掛程式不提供配置GUI,以便更輕鬆地維護其與WordPress未來的更新。

目前在您的 wp-config.php 中有3個可配置的常數,我建議使用 WP-CLI 來維護這些常數。

MAHR_LENGTH: 隨機雜湊標識的長度,預設為8,長一點可以幫助減少碰撞。長度為8的雜湊標識在50,000張圖像的規模下可以無碰撞。
MAHR_CHARS:雜湊標識中使用的字元,預設為0123456789abcdefghijklmnopqrstuvwxyz_,你可以添加更多的字元(例如大寫字母)來大幅減少碰撞,而不必增加檔案名的長度。但請注意,如果您不熟悉通用URI編碼,此選項可能會很危險。如果你不知道什麼樣的字元是允許出現在檔名中的,請不要額外修改且使用預設選項。
MAHR_IGNORE:要忽略的檔案副檔名,預設為pdf, zip,您可以定義一個逗號分隔的檔案副檔名列表以繞過此外掛程式的重新命名流程。所有檔案都將被忽略,如果這些檔案具有您在列表中定義的文件副檔名。請注意以下幾點:

檔案副檔名必須在前面沒有句號的情況下定義,例如:使用'pdf, 7z, bmp'(正確),'.pdf, .7z, .bmp'(錯誤)。
帶空格('pdf, zip')和不帶空格('pdf,zip')都行。
如果您定義自己的忽略列表,將放棄預設的忽略列表。例如,如果您定義了'7z',則'pdf, zip'會在上傳過程中被處理。您需要使用'7z, pdf, zip'重新定義這些檔案類型。
如果你不需要忽略任何檔案副檔名,可以將此選項定義為一個空陣列[](不帶引號):define('MAR_IGNORE', []);以強制重新命名PDF和ZIP文件。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Media Auto Hash Rename」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Media Auto Hash Rename will rename any file (specific files can be ignored by file extension) during upload, with unique, low collision hashes. Hash characters and length can be configured for even lower collision rate.
More information please visit my site.
This plugin provides no configuration GUI to make it more easier to maintain with the future WordPress updates.
Currently there’re 3 constants you can configure in your wp-config.php, I recommend WP-CLI for maintaining these constants.

MAHR_LENGTH: length of the random hashes, (default to 8), longer can help reduce collision. Hashes at the length of 8 can be collision-free at the scale of 50,000 images).
MAHR_CHARS: Characters used in hashes, default to 0123456789abcdefghijklmnopqrstuvwxyz_, You can add more characters like uppercased alphabelts to dramatically reduce the collision without increasing the length of your filenames. But please note that this option can be dangerous if you’re not familer with general URI encoding. So if you don’t know what characters are allowed in a filename, just keep it untouched and use the default option.
MAHR_IGNORE: File extensions to be ignored, default to pdf, zip, you can define a comma delimited list of file extensions to bypass renaming process of this plugin. All files that has the file extension you defined in the list will be ignored. Please note that:

File extensions must be defined without the leading peroid, for example: 'pdf, 7z, bmp' works, '.pdf, .7z, .bmp' does not.
With ('pdf, zip') or without ('pdf,zip') space both work.
If you define your own ignore list, default ignore list will be discarded. For example, if you define '7z', then 'pdf, zip' will be processed during upload. You need to reapply these extensions with your own: '7z, pdf, zip'.
If you don’t need to ignore any files by its extension. define an empty array [] (without quotes) to this option: define( 'MAR_IGNORE', [] ); to force process PDF and ZIP files.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon