[WordPress] 外掛分享: Advanced Custom Fields: Image Aspect Ratio Crop Field

首頁外掛目錄 › Advanced Custom Fields: Image Aspect Ratio Crop Field
20,000+
安裝啟用
★★★★
4.8/5 分(26 則評價)
163 天前
最後更新
問題解決
WordPress 4.9+ PHP 5.6+ v6.0.5 上架:2018-07-11

內容簡介

這是一個進階自訂欄位 (Advanced Custom Fields) 的外掛,會在使用者上傳圖片後強制執行特定的長寬比例或像素大小裁剪。使用長寬比例對於回應式圖片的使用情境特別有用。

在裁剪後,縮圖會產生並儲存在文章裡,使用者可以隨時從文章頁面重新裁剪原始圖片。

裁剪後的圖片變體預設是隱藏的,但在媒體瀏覽器及媒體頁面上的「列表檢視」選項中可查看。

此外掛有三種模式:長寬比例、像素大小和自由裁剪,您可以在 ACF 欄位選項中選擇此選項。

長寬比例

如果您希望圖像具有特定的長寬比率,例如 16:9,但像素大小不重要,可以使用此選項。

使用者在選擇圖像後,可以選擇符合該長寬比例的圖像區域,點擊裁剪後,將從原始圖像裁剪出指定區域。

如果需要更小的圖像大小,可以利用 WordPress 的縮圖功能來使用更小的圖像版面。

像素大小

如果您需要特定的像素大小圖像,例如 640 × 480,則可以使用此選項。使用者將無法選擇小於定義像素大小的圖像。

在選擇圖像後,使用者可以選擇要使用的圖像區域,區域可能比像素大小大,但區域的長寬比例必須鎖定根據像素大小。

點擊裁剪後,將從原始圖像裁剪出指定區域。裁剪完成後,圖像將自動縮小到像素大小,因此最終圖像將始終是指定的大小。

自由裁剪

裁剪可以自由進行,沒有長寬比例限制。

需求

WordPress 4.9 或更新版本
PHP 5.6 或更新版本
Advanced Custom Fields 5.8 或更新版本 (可用於免費版或付費版)

相容性

Polylang Pro
Enable Media Replace
WP Offload Media、Media Cloud 及其他將媒體檔案移動到遠端位置的外掛
Advanced Custom Fields 5.8 或更新版本 (可用於免費版或付費版)

致謝

特別感謝 Anders Thorborg 提供的 ACF Image Crop,它為此外掛提供了靈感。同樣,感謝 Fengyuan Chen 提供的 cropper.js 函式庫!

外掛標籤

開發者團隊

⬇ 下載最新版 (v6.0.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Advanced Custom Fields: Image Aspect Ratio Crop Field」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

A field for Advanced Custom Fields that forces the user to crop their image to specific aspect ratio or pixel size after uploading. Using an aspect ratio is especially useful in responsive image use cases.
After cropping, a new cropped image variant is created in the gallery and saved into the post. Thumbnails are also generated for the new image. User can re-crop the original image at any time from the post page.
The cropped image variants are hidden by default in the media browser and on the media page but you can view them by selecting the “list view” on the media page.
There are three modes of operation: aspect ratio, pixel size and free crop. You can select this option when creating the field in ACF field options.
Aspect ratio
Use this option if you want the image to be of specific aspect ratio like 16:9 but the pixel size is not important.
After selecting an image, user can select an area from the image that matches this aspect ratio. When crop button is pressed, the area is cropped from the original image.
If you need a smaller image size, you make use of WordPress’s thumbnail functionality to access a smaller version of the image.
Pixel size
Use this option if you need a specific pixel size image like 640×480. User will not be able to select an image smaller than the defined pixel size.
After selecting an image, user can select an area from the image they want, which can be larger than the pixel size but may not be smaller. The aspect ratio of the selection is locked according to the pixel size.
When crop button is pressed, the area is cropped from the original image. After the crop is complete, the image will be automatically scaled down to the pixel size. This means the final image will always be the specified size.
Free crop
Crop can be done freely, there are no aspect ratio limitations.
Requirements

WordPress 4.9 or later
PHP 5.6 or later
Advanced Custom Fields 5.8 or later (Pro or Free)

Compatibility

Polylang Pro
Enable Media Replace

WP Offload Media, Media Cloud and other plugins that move media files to remote location

ACF 5.8 or later (Pro or Free)

Thanks
Special thanks to Anders Thorborg for ACF Image Crop which served as a inspiration for this plugin. Also, thanks to Fengyuan Chen for the cropper.js library!

延伸相關外掛

文章
Filter
Mastodon