[WordPress] 外掛分享: Image Cropper

首頁外掛目錄 › Image Cropper
40+
安裝啟用
尚無評分
5353 天前
最後更新
問題解決
WordPress 3.0+ v0.3.0 上架:2011-07-20

內容簡介

如需將文章縮圖圖片裁剪為 200×300 像素,請使用以下程式碼:

<?php
the_post();
img(200, 300);
?>

此程式碼會驗證文章縮圖是否存在,並裁剪圖片、將其保存在 uploads 資料夾中,然後產生一個圖片標籤。

若要驗證文章縮圖是否存在,您可以使用 has_img()

<?php if (has_img()): ?>
<figure>
<?php img(200, 300) ?>
<figcaption>一些文字</figcaption>
</figure>
<?php endif ?>

若要裁剪非文章縮圖的圖片,您可以使用 crop($url, $size)

<?php
$cropped_url= crop( get_bloginfo('url') . '/wp-content/uploads/image.jpg', array(200, 300) );
?>
<img src="<?php echo $cropped_url ?>">

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.3.0) 或搜尋安裝

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

原文外掛簡介

For cropping a post thumbnail image to 200×300 pixels:

This will verify the existence of post thumbnail, crop the image, save it in uploads folder, and generate an image tag.
To verify the existence of a post thumbnail, you can use has_img()

Some text

To crop images that are not post thumbnails, you can use crop($url, $size)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon