[WordPress] 外掛分享: Ravatars

首頁外掛目錄 › Ravatars
10+
安裝啟用
尚無評分
4204 天前
最後更新
問題解決
WordPress 2.0.2+ v2.0.4 上架:2008-03-04

內容簡介

Ravatars 是一個外掛,可以為到您的網站留言的訪客生成並分配圖示。這些圖示是基於電子郵件生成,因此每個訪客在留言時都會得到相同的圖示。您可以輕鬆地自定義這些圖示,使其與您的網站主題或風格相匹配。當人們有一個容易記住的“面孔”時,也可以更輕鬆地跟踪留言串。

這個外掛是基於 Shamus Young 的 Wavatars 外掛的。

再次感謝 Gregory Weir 進行了錯誤修正。謝謝!

功能:

您可以自定義網站顯示的圖示以匹配您的主題。只需上傳源圖像到 wp-content/plugins/ravatars/parts 目錄即可。Ravatars 將通過選擇一個隨機圖像並剪裁圖像的隨機部分來創建您的自定義圖示。
圖示是即時生成的。您可以調整所需圖示的大小。
易於集成具有圖示支持的主題
對於在 WordPress 2.5 之前的版本中的一鍵部署,圖示將自動出現在評論者的名字前面。您可以設置直接在圖示之前和之後顯示 HTML(例如放在 DIV 標籤內),或者如果您願意添加一行 PHP 代碼到您的主題中就可以手動控制圖示的位置。
如果源圖像沒有改變,同一個電子郵件地址每次都會生成相同的 Ravatar。如果您想要為您的網站使用獨特的頭像,只需要更改源圖像即可。
此外,該外掛還支持 Gravatars。如果您喜歡,它可以顯示給定用戶的 Gravatar(如果有),並只在他們沒有設置 Gravatar 時使用他們的 Ravatar。這意味著用戶可以選擇為自己設置獨特的圖示,如果他們不這樣做,他們將被分配一個獨特的 Ravatar。這是一個讓人們可以自己定制的系統,但仍然為那些懶惰或漠不關心的人提供一個像樣的圖示。

修訂歷史
版本 1.0.1

初始版本。

高級技巧
如果出現內存錯誤

圖像操作函數需要很多內存。如果出現內存錯誤,請嘗試通過降低解析度或將它們裁剪成更小的部分來減小源圖像的大小。您還可以增加 PHP 的 memory_limit。

使用 ravatar_show()

如果手動調用 ravatar_show() 放置 Ravatars,在默認值之外,還可以指定可選的“size”參數以覆蓋默认值。例如:

ravatar_show($comment->comment_author_email, '160');

這將導致 Ravatar 的尺寸為 160×160 像素,即使默認值設置為其他值。例如,您可以使管理員圖示變大。

使用 ravatar_get()

如果 ravatar_show() 還不足夠控制,您可以調用:

ravatar_get(email, size);

它將返回所創建圖像的 URL 而無需將其寫入頁面。

隨機 Ravatar 欄位

將此代碼放入主題中:

for ($i = 0; $i < 100; $i++)
ravatar_show ($i);

它將生成 100 個隨機 Ravatars 的欄位,很酷,這就是我生成 Ravatar 截圖的方法。這也是快速測試您的源圖像的好方法。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Ravatars」→ 直接安裝(推薦)

原文外掛簡介

Ravatars is a plugin that will generate and assign icons to the visitors leaving comments at your site. The icons are based on email,
so a given visitor will get the same icon each time they comment. It is easy to customize the avatars so that they match your site’s topic or theme. It also makes comment threads easier to follow when people have memorable “faces.”
This plugin is based on Shamus Young’s Wavatars plugin.
And a shout out to Gregory Weir for bugfixes. Thanks!
Features:

You can customize the avatars your site will display to match your theme. Just upload source images to the
wp-content/plugins/ravatars/parts directory. Ravatars will create your custom avatars by choosing a random image and then cropping a random
part of the image
The icons are generated on-the-fly. You can adjust the desired size of the icons.
Easily integrates with avatar enabled themes
For easy deployment in WordPress pre 2.5, icons will automatically precede the commenter’s name. You can set HTML to come directly before and after the
icon (to put it inside of a

tag, for example) or you can control the placement of the icons manually if you don’t mind adding
a single line of PHP to your theme.
The same email will result in the same Ravatar every time, assuming that the source images don’t change the same. If you want avatars that are unique to your site, all you need to do is change the source images.
This plugin also supports Gravatars. If you like, it can show the Gravatar for a given user
(if available) and fall back on their Ravatar only if they don’t have a Gravatar set up. This means users can choose to set up a unique
icon for themselves, and if they don’t, they will be assigned a unique Ravatar. It’s a system that lets people personalize if
they want, yet still provide a decent icon for the lazy or apathetic.

Revision History
Version 1.0.1

Initial release.

Advanced Tricks
If you get a memory error
Image manipulation functions are very memory intensive. If you get a memory error, try reducing the size of your source images by lowering the resolution or cropping them into smaller parts. You can also increase PHP’s memory_limit.
Using ravatar_show ()
If you place Ravatars by calling ravatar_show () manually, note that you can also specify an optional “size” argument to override the
default. For example:
ravatar_show($comment->comment_author_email, '160');

This would cause the Ravatar to be 160×160 pixels, even if the default was set to some other value. You could do this to make admin icons
larger, for example.
Using ravatar_get ()
If ravatar_show () STILL doesn’t give you enough control, you can call:
ravatar_get(email, size);

And it will return the URL to the created image without writing anything to the page.
Random Ravatar Field
Put this code in your theme:
for ($i = 0; $i < 100; $i++) ravatar_show ($i); It will generate a field of 100 random ravatars, which is cool. This is how I generated the ravatar screenshot. It’s also a great way to quickly test your source images.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon