內容簡介
Specify Missing Image Dimensions(指定缺少圖片尺寸)是一個 WordPress 外掛程式,可以協助添加缺少的圖片寬度和高度屬性。此外掛會掃描整個 HTML 頁面,並為所有缺少寬度和高度屬性的圖片 tags 加上。
如果您在 Google PageSpeed Insights 上看到像「圖像元素沒有明確的寬度和高度」這樣的錯誤,那麼這個外掛程式就能在必要時加上缺少的圖片寬度和高度屬性,協助您消除錯誤。
透過在圖片上添加寬度和高度屬性,也能改善累積版面位移(CLS),進而避免 HTML 頁面渲染時出現不必要的跳動。
外掛程式如何運作
Specify Missing Image Dimensions 外掛程式掃描整個 HTML 頁面並查找缺少寬度和高度屬性的圖片。
找到圖片後,外掛程式使用 getimagesize() 函數取得圖片大小。
在取得所需尺寸後,此外掛程式會為圖片添加寬度和高度屬性。
功能
按圖片擴展名排除圖片
按圖片名稱排除圖片
按類別排除圖片
按 ID 排除圖片
外掛標籤
開發者團隊
② 後台搜尋「Specify Missing Image Dimensions」→ 直接安裝(推薦)
原文外掛簡介
Specify Missing Image Dimensions is a WordPress plugin that helps to add missing width and height attributes to images. This plugin scans the entire HTML page and specify missing width and height to tags.
If you are seeing error like “Image elements do not have explicit width and height” on Google PageSpeed Insights then this plugin will help you to remove that error by adding missing width and height attributes to the required images.
By adding width and height to the images, Cumulative Layout Shift (CLS) also improves as there will be no more unwanted jumps while HTML page rendering.
How this Plugin Works
Specify Missing Image Dimensions plugin scans the entire HTML page and finds images with missing width and height attributes.
After finding the images, this plugin gets the image dimensions using getimagesize() function.
After getting the required dimensions, plugin adds the width and height attributes to the images.
Features
Exclude images by image extension
Exclude images by image Name
Exclude images by class
Exclude images by ID
