[WordPress] 外掛分享: AutoThumb

首頁外掛目錄 › AutoThumb
80+
安裝啟用
★★★★★
5/5 分(1 則評價)
5153 天前
最後更新
問題解決
WordPress 2.7+ v0.6.1 上架:2009-04-17

內容簡介

這個外掛實際上只是我之前為 MODx 寫的一個外掛 / 程式碼段的轉換建構。它會掃描您內容的原始碼中帶有寬度和高度屬性的 <img> 標籤並將它們傳遞給phpThumb,一個在 PHP 圖像編輯庫中很棒的工具,負責調整和編輯圖像。此外,通過使用查詢字串傳遞參數給 phpThumb,它可以以多種方式編輯圖像(請查看phpThumb 的演示)。

取得調整大小圖像的最簡單方式就是在 HTML 中指定寬度/高度屬性。AutoThumb 將使用給定的值並從您網頁的輸出中刪除屬性。當您查看在外掛主頁上發現的範例圖像的 URL 時,您會看到 <img> 標籤的 src 屬性指向插件目錄中的一個名為 image.php 的文件。此文件將圖像源和幾個其他參數傳遞給 phpThumb,後者將生成並輸出最終圖像(當然,圖像將被緩存)。

為了防止壞人通過查詢字符串來讓您的服務器生成大量不同的圖像,外掛會生成一個哈希值,其中包含了查詢字符串和您在 phpThumb 配置文件中設置的一個秘密密碼的組合。因此,每個帶有不同參數的調用(即使是不同大小的相同圖像)都有另一個唯一的哈希值,而不知道秘密密碼是不可能生成新圖像的。

查看外掛頁面以獲取有關該外掛的更多詳細信息。

所有開發工作都在GitHub上進行。如果您有想法、增強功能等,請隨時創建分支並發送拉取請求。

如有任何問題,請使用問題追蹤器。

外掛標籤

開發者團隊

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

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

原文外掛簡介

The plugin is actually just a port of a plugin/snippet I wrote for MODx a while ago (see here). It scans your content’s source code for tags with width and height attributes and passes them to phpThumb, a great PHP image editing library, which handles the resizing and editing of the image. Additionally, by passing parameters to phpThumb using a query string, it’s possible to edit the image in several ways (take a look at phpThumb’s demos).
The simplest way to get resized images is to specify width/height attibutes in your HTML. AutoThumb will use the given values and remove the attributes from your page’s output. When you take a look at the URLs of the example images found on the plugin home page, you will see that the -tag’s src-attribute points to a file called image.php in the plugin’s directory. This file takes the image source and several other parameters and passes them to phpThumb, which will generate and output the final image (of course images will be cached).
To prevent evil people playing with the query string and letting your server generate tons of different images, the plugin generates a hash which is a combination of the query string and a secret password you set in phpThumb’s config file. So every call with different parameters (even the same image with different sizes) has another unique hash and it’s not possible to generate new images without knowing the secret password.
See the plugin page for more details on the plugin.
All development is done on GitHub. If you have ideas, enhancements, etc. feel free to fork the project and send a pull request.
For any issues please use the Issue Tracker.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon