外掛說明
Regenerate Thumbnails 能讓網站管理員為已上傳至網站 [媒體庫] 的一或多張圖片重新產生縮圖。
這對下列狀況相當有幫助:
- 網站註冊了新的縮圖尺寸,而網站管理員需要為之前已上傳的圖片以新的縮圖尺寸產生新縮圖。
- 網站管理員變更了網站現有縮圖的尺寸設定,例如在 [設定]→[媒體] 中變更了縮圖尺寸設定。
- 網站管理員為網站更換了佈景主題,而新的佈景主題需要不同尺寸的精選圖片。
這個外掛也能刪除舊版、尺寸已不再使用的縮圖,以便釋出網站伺服器儲存空間。
紀念 Alex Mills
Alex Mills 是這個外掛的原開發者,已於 2019 年 2 月離世。他所留下的多個外掛,目前均由 Automattic 及 WordPress 社群成員共同維護。如果這個外掛對你的網站有所幫助,請考慮贊助 Oregon Health and Science University 這所大學。如需進一步了解相關資訊,請點擊這裡。
替代方案
WP-CLI
如果網站管理員可以透過命令列存取網站伺服器,非常建議改用不需 HTTP 要求額外負荷、執行效能更快的 WP-CLI 取代這個外掛,而且 WP-CLI 還能在同一個畫面中同時處理大量縮圖。如需進一步資訊,請參閱 media regenerate
命令的線上說明。
Jetpack 的 Photon 模組
Jetpack 是由 WordPress.com 的母公司 Automattic 所開發的外掛。Jetpack 能提供了一些由 WordPress.com 託管網站才能使用的功能供自架的 WordPress 網站使用。
Photon 模組能讓網站上的圖片透過 WordPress.com 的全球內容傳遞網路 (CDN) 提供,以便加速網站圖片的載入。重要的是,Photon 模組同時也能產生縮圖,這代表啟用 Photon 模組的網站不需要使用這個外掛。
我個人在自己的網站上是使用 Photon。
免責聲明:我 (指外掛開發者) 任職於 Automattic,但即使我不在 Automattic 工作,一樣會推薦使用 Jetpack 的 Photon。
需要協助?找到程式碼錯誤?想要貢獻程式碼?
這個外掛透過 WordPress.org 的技術支援論壇提供外掛技術支援。
外掛的原始程式碼可在 GitHub 存放庫中找到。
安裝方式
- 從管理後台選單前往 [外掛]→[安裝外掛]。
- 搜尋「Regenerate Thumbnails」。
- 點擊 [安裝]。
- 點擊 [啟用外掛]。
- 前往 [工具]→[重新產生縮圖]。
常見問題集
-
這個外掛是否符合 GDPR (https://en.wikipedia.org/wiki/General_Data_Protection_Regulation) 標準?
-
這個外掛不會記錄或傳輸任何使用者資料。事實上,這個外掛僅會在管理後台執行,而不會處理任何網站前端的使用者相關行為,這代表這個外掛應該符合 GDPR 標準。請注意,這只代表我 (指外掛開發者) 的個人見解,而非專業法律意見。
使用者評論
參與者及開發者
變更記錄
Version 3.1.6
- Fix: Respect “Skip regenerating existing correctly sized thumbnails” setting.
- Fix: Don’t delete all thumbnails when deleting old unregistered thumbnails size.
Version 3.1.5
- Fix: Don’t overwrite ‘All X Attachment’ button label with featured images count.
- Tested successfully with PHP 8.1.
- Tested successfully with PHP 8.2.
Version 3.1.4
- Fix: Don’t attempt to regenerate SVG’s.
- Bump tested version.
- Update dependencies.
Version 3.1.3
- Update plugin dependencies to the latest version.
Version 3.1.2
- Use wp_get_original_image_path() in WordPress 5.3
Version 3.1.1
- Minor fix to avoid a divide by zero error when displaying thumbnail filenames.
Version 3.1.0
- Bring back the ability to delete old, unregistered thumbnail sizes. Support for updating post contents is still disabled (too buggy).
- Various code improvements including string localization disambiguation.
Version 3.0.2
- Fix slowdown in certain cases in the media library.
- Fix not being able to regenerate existing thumbnails for single images. Props @idofri.
- Fix JavaScript error that could occur if the REST API response was unexpected (empty or PHP error).
- Fix bug related to multibyte filenames.
- If an image is used as the featured image on multiple posts, only regenerate it once instead of once per post.
Version 3.0.1
- Temporarily disable the update post functionality. I tested it a lot but it seems there’s still some bugs.
- Temporarily disable the delete old thumbnails functionality. It seems to work fine but without the update post functionality, it’s not as useful.
- Try to more gracefully handle cases where there’s missing metadata for attachments.
- Wait until
init
to initialize the plugin so themes can filter the plugin’s capability.plugins_loaded
is too early. - Fix a JavaScript error that would cause the whole regeneration process to stop if an individual image returned non-JSON, such as a 500 error code.
- Accept GET requests for the regenerate REST API endpoint instead of just POSTs. For some reasons some people’s sites are using GET despite the code saying use POST.
- Make the attachment ID clickable in error messages.
- Fetch 25 attachments at a time instead of 5. I was using 5 for testing.
- PHP notice fixes.
Version 3.0.0
- Complete rewrite from scratch using Vue.js and the WordPress REST API.
Version 2.2.4
- Better AJAX response error handling in the JavaScript. This should fix a long-standing bug in this plugin. Props Hew Sutton.
Version 2.2.3
- Make the capability required to use this plugin filterable so themes and other plugins can change it. Props Jackson Whelan.
Version 2.2.2
- Don’t check the nonce until we’re sure that the action called was for this plugin. Fixes lots of “Are you sure you want to do this?” error messages.
Version 2.2.1
- Fix the bottom bulk action dropdown. Thanks Stefan for pointing out the issue!
Version 2.2.0
- Changes to the Bulk Action functionality were made shortly before the release of WordPress 3.1 which broke the way I implemented the specific multiple image regeneration feature. This version adds to the Bulk Action menu using Javascript as that’s the only way to do it currently.
Version 2.1.3
- Move the
error_reporting()
call in the AJAX handler to the beginning so that we’re more sure that no PHP errors are outputted. Some hosts disable usage ofset_time_limit()
and calling it was causing a PHP warning to be outputted.
Version 2.1.2
- When regenerating all images, newest images are done first rather than the oldest.
- Fixed a bug with regeneration error reporting in some browsers. Thanks to pete-sch for reporting the error.
- Supress PHP errors in the AJAX handler to avoid sending an invalid JSON response. Thanks to pete-sch for reporting the error.
- Better and more detailed error reporting for when
wp_generate_attachment_metadata()
fails.
Version 2.1.1
- Clean up the wording a bit to better match the new features and just be easier to understand.
- Updated screenshots.
Version 2.1.0
Lots of new features!
- Thanks to a lot of jQuery help from Boris Schapira, a failed image regeneration will no longer stop the whole process.
- The results of each image regeneration is now outputted. You can easily see which images were successfully regenerated and which failed. Was inspired by a concept by Boris.
- There is now a button on the regeneration page that will allow you to abort resizing images for any reason. Based on code by Boris.
- You can now regenerate single images from the Media page. The link to do so will show up in the actions list when you hover over the row.
- You can now bulk regenerate multiple from the Media page. Check the boxes and then select “Regenerate Thumbnails” form the “Bulk Actions” dropdown. WordPress 3.1+ only.
- The total time that the regeneration process took is now displayed in the final status message.
- jQuery UI Progressbar version upgraded.
Version 2.0.3
- Switch out deprecated function call.
Version 2.0.2
- Directly query the database to only fetch what the plugin needs (the attachment ID). This will reduce the memory required as it’s not storing the whole row for each attachment.
Version 2.0.1
- I accidentally left a
check_admin_referer()
(nonce check) commented out.
Version 2.0.0
- Recoded from scratch. Now uses an AJAX request per attachment to do the resizing. No more PHP maximum execution time errors or anything like that. Also features a pretty progress bar to let the user know how it’s going.
Version 1.1.0
- WordPress 2.7 updates — code + UI. Thanks to jdub and Patrick F.
Version 1.0.0
- Initial release.
Upgrade Notice
Support for WordPress 5.3