
內容簡介
Presswell Art Direction 可以協助簡化自訂圖片縮圖大小的定義、裁切和產生。
功能
使用熱點來控制圖片裁切
選擇 WordPress 編輯器中的自訂圖片尺寸
動態生成圖片縮圖
刪除所有快取的縮圖
圖片裁切
Presswell Art Direction 加入了對於媒體庫中所有圖片設置聚焦點熱點的功能,以進一步控制圖片的裁切。只需識別照片的主題在哪裡,插件就會裁切所有自訂縮圖,以確保主題保持在畫面中。
縮圖大小
Presswell Art Direction 提供了一個易於使用的介面,可用於定義和編輯自訂圖片縮圖大小。在插入文章時,可以選擇自訂圖片尺寸。
動態圖片
Presswell Art Direction 防止自訂圖片尺寸自動產生。當上傳新圖片時,只會生成標準 WordPress 縮圖。當通過代碼調用或通過 URL 請求時,所有其他圖片尺寸將動態生成,這樣在定義多個自訂圖片尺寸時能節省服務器空間。注意:基於 URL 的圖像生成需要啟用美麗的永久連結。
文檔
pwad_add_image_size( $args )
$args (array) (required) – 包含 name,key,height,width 和可選 thumbnails 值的鍵入散列;縮圖鍵以父節點的關鍵字為前綴,例如 ‘[size]-[thumbnail]’
範例:
pwad_add_image_size( array(
'name' => '正方形',
'key' => 'square',
'width' => '1200',
'height' => '1200',
'thumbnails' => array(
array(
'name' => '中等',
'key' => 'medium',
'width' => '800',
'height' => '800',
),
array(
'name' => '小',
'key' => 'small',
'width' => '400',
'height' => '400',
),
),
) );
pwad_get_image( $attachment_ID, $size_key, $thumbnail_key )
$attachment_ID (int) (required) – 圖像附件的 ID
$size_key (string) (required) – 圖像尺寸標識符;使用 ‘[size]-[thumbnail]’ 模式進行重載
$thumbnail_key (string) (required) – 圖片尺寸縮略圖標識符
返回圖像標籤。
範例:
$square_large = pwad_get_image( $img_ID, 'square' );
$square_medium = pwad_get_image( $img_ID, 'square', 'medium' );
$square_small = pwad_get_image( $img_ID, 'square-small' ); // 重載
pwad_get_image_src( $attachment_ID, $size_key, $thumbnail_key )
$attachment_ID (int) (required) – 圖像附件的 ID
$size_key (string) (required) – 圖像尺寸標識符;使用 ‘[size]-[thumbnail]’ 模式進行重載
$thumbnail_key (string) (required) – 圖片尺寸縮略圖標識符
返回一個包含 file、url、path、height、width 和 mime-type 值的鍵入散列。
範例:
$square_large = pwad_get_image_src( $img_ID, 'square' );
$square_medium = pwad_get_image_src( $img_ID, 'square', 'medium' );
$square_small = pwad_get_image_src( $img_ID, 'square-small' ); // 重載
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Presswell Art Direction gives editors and developers a consistent way to manage image sizing and cropping in WordPress. Define custom sizes, set focal points, and generate non-core thumbnails only when they are actually needed.
Features
Control image cropping with focal points
Define custom image sizes and nested thumbnail variants
Select custom image sizes directly in the WordPress editor
Dynamically generate non-core thumbnails on demand
Run batch regeneration from a dedicated Media tool
Use Endpoint Mode when filename-based 404 handoff is unavailable
Import/export size definitions and migrate legacy focal-point metadata
Focal Point Cropping
Set a focal point for Media Library images to control how custom crops are framed. Mark the visual subject once, and generated thumbnails stay centered on the correct area.
Custom Size Management
Use the settings UI to define and edit custom image sizes. Registered sizes become available when inserting images in the block editor and classic editor workflows.
Dynamic Generation + Endpoint Mode
Presswell Art Direction avoids generating every custom size at upload time. WordPress core sizes are generated normally, while custom sizes are generated when requested in templates or by URL.
If filename-based 404 image requests do not reach WordPress (common in some NGINX/server setups), enable Endpoint Mode (/pwad-image/?id=...&size=...). The plugin includes an automatic compatibility check in wp-admin.
Regenerator
The Regenerator screen (Media -> Regenerate Thumbnails) builds a queue and processes images in batches, with progress metrics and retry handling for failed jobs. You can choose exactly which sizes should be regenerated.
Documentation
Public APIs
pwad_add_image_size( $args )
$args (array) (required) – Keyed array containing name, key, height, width, crop (optional), and optionally thumbnails values.
Thumbnail keys are prefixed with parent’s key like [size]-[thumbnail].
Example:
pwad_add_image_size( array(
'name' => 'Square',
'key' => 'square',
'width' => '1200',
'height' => '1200',
'crop' => true,
'thumbnails' => array(
array(
'name' => 'Medium',
'key' => 'medium',
'width' => '800',
'height' => '800',
),
array(
'name' => 'Small',
'key' => 'small',
'width' => '400',
'height' => '400',
),
),
) );
pwad_get_image_sizes()
Returns all currently-available sizes (WordPress defaults + plugin/theme sizes + Presswell Art Direction sizes/thumbnails).
Example:
$sizes = pwad_get_image_sizes();
pwad_get_image( $attachment_ID, $size_key, $attr = array() )
$attachment_ID (int) (required) – ID of image attachment
$size_key (string) (required) – Image size identifier (thumbnail, large, my-size, my-size-mobile, etc.)
$attr (array) (optional) – HTML attributes passed to the rendered image element
Returns an image tag.
Example:
$square_large = pwad_get_image( $img_ID, ‘square’ );
$square_small = pwad_get_image( $img_ID, ‘square-small’, array( ‘class’ => ‘hero-image’ ) );
pwad_get_image_src( $attachment_ID, $size_key )
$attachment_ID (int) (required) – ID of image attachment
$size_key (string) (required) – Image size identifier (thumbnail, large, my-size, my-size-mobile, etc.)
Returns a keyed array containing the file, url, path, height, width, and mime-type values.
Example:
$square_large = pwad_get_image_src( $img_ID, ‘square’ );
$square_small = pwad_get_image_src( $img_ID, ‘square-small’ );
WP-CLI
wp pwad regenerate
Regenerates thumbnails.
--queue-per-page=
--batch-size=
--target-seconds=
--resume-last=<0|1> (default 0, continue the last interrupted queue)
wp pwad cache-prime
Generates thumbnails based on sitemap.
--sitemap=
--page-limit=
--image-limit=
--delay-ms=
--timeout=
--retries=
--include-external=<0|1> (default 0)
--force-endpoint=<0|1> (default 0)
--report-csv=
--dry-run=<0|1> (default 0)
--resume-last=<0|1> (default 0, continue the last interrupted prime run)
wp pwad cache-prune
Deletes cached thumbnails not referenced in sitemap.
--sitemap=
--batch-size=
--max-images=
--page-limit=
--image-limit=
--timeout=
--grace-days=
--include-external=<0|1> (default 0)
--force-endpoint=<0|1> (default 0)
--report-csv=
--dry-run=<0|1> (default 1)
--resume-last=<0|1> (default 0, continue the last interrupted prune run)
wp pwad cache-clean
Deletes all cached thumbnails.
--batch-size=
--max-images=
--include-default=<0|1> (default 0)
--dry-run=<0|1> (default 1)
--resume-last=<0|1> (default 0, continue the last interrupted clean run)
wp pwad queue-status
Shows resumable/remaining state for regenerator and cache queue runs.
Privacy
Presswell Art Direction does not send image data to external services. It processes image metadata and generated variants within your WordPress environment.
