[WordPress] 外掛分享: WP GIF Player – Play & Pause

首頁外掛目錄 › WP GIF Player – Play & Pause
WordPress 外掛 WP GIF Player – Play & Pause 的封面圖片
400+
安裝啟用
★★★★★
5/5 分(1 則評價)
1803 天前
最後更新
問題解決
WordPress 5.0+ PHP 7.0+ v0.1.3 上架:2020-04-21

內容簡介

您可以在外掛選項頁面中選擇三種 GIF 播放方式之一。

GIF

這是預設方法。

當在您的媒體庫中上傳 GIF 時,會創建一個圖像縮略圖以作為 GIF 播放器的預覽。當用戶點擊 GIF 播放器時,原始 GIF 將只加載一次。

Canvas

使用此方法,每個 GIF 將在您的文章中加載,並轉換為可播放的 Canvas。上傳 GIF 時也會創建縮略圖像。

在此過程中,我們使用 BuzzFeed 的 libgif.js JavaScript 函式庫。

影片 (建議使用)

每個 GIF 文件將轉換為以下視頻格式:

WebM
MP4

為什麼要使用視頻?

眾所周知,GIF 文件的大小比視頻大,因此使用視頻而不是 GIF 文件將有助於提高您的網站性能。

想了解更多有關將 GIF 轉換為視頻的詳細信息嗎?請查看 GIF 當作影片Wiki。

縮略圖預覽

該外掛會提取 GIF 檔案並將第一個幀轉換為 JPEG 圖像作為縮略圖預覽。此文件將保存在原始 GIF 的同一文件夾中。

縮略圖圖像始終會生成一次,並且不會影響所選擇的 GIF 方法。

短碼

如果您仍在使用WordPress傳統編輯器,則必須使用以下短碼:

[gif-player id="gif_id"]

如果您不知道 GIF ID,則可以在「添加媒體」按鈕旁邊使用「添加 GIF 播放器」按鈕添加 GIF 播放器。

當您單擊「添加 GIF 播放器」按鈕時,媒體庫窗口將打開,您將能夠選擇或上傳您的 GIF。

當您保存並查看帖子時,外掛會根據插件選項頁面中選擇的 GIF 方法呈現 GIF 播放器。

Gutenberg區塊

您可以將 GIF 播放器作為 Gutenberg 區塊使用。查看更多詳細信息。

與Lazy Load兼容嗎?

一些Lazy Load 外掛與外掛中的三種 GIF 播放方法兼容,但是有些外掛將不允許您播放 GIF 播放器。

如果 GIF 播放器無法播放,您可以使用GIF CSS類跳過Lazy Load,請使用您的Lazy Load外掛過濾器。

每個 GIF 播放器的 CSS 類為:

GIF: wp-gp-pp-gif
Canvas: wp-gp-pp-gif-canvas-player
Video: wp-gp-pp-video-player

如果您的 Lazy Load 外掛要求您在 GIF 資產中添加自定義 CSS 類以避免懶加載,則必須在您的functions.php文件中使用GIF 播放器自定義過濾器。查看自定義過濾器以避免 GIF 播放器的懶加載。

當播放器作為影片失效時的 GIF 作為回落方案

如果任何原因導致當前的 GIF 播放器作為影片沒有任何視頻源,該外掛將使用 GIF 預設播放器 (GIF) 作為回落方案進行渲染。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP GIF Player – Play & Pause」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

You can select one of the three GIF player methods in the plugin options page.
GIF
This is the default method.
When a GIF is uploaded in your Media Library it will create an image thumbnail to use it as the GIF player preview and when the user clicks on the GIF player the original GIF will be loaded once.
Canvas
With this method every GIF will be loaded in your post and then converted into a playable canvas. A thumbnail image is created as well when uploading the GIF in your Media Library.
For this process we’re using the libgif.js JavaScript library by BuzzFeed.
Video (Recommended)
Every GIF file will be converted to these video formats:

WebM
MP4

Why videos?
It is known that GIF files sizes are bigger than a video so using a video instead of a GIF file will help your website performance.
Want more details about converting GIF to video? Check the GIF as Video wiki.
Thumbnail Preview
The plugin will grab the GIF file and extract the first frame as JPEG image and use it as thumbnail preview. This file will be saved in the same folder of the original GIF.
The thumbnail image always generate once and doesn’t matter the selected GIF method.
Shortcode
If you’re still using the WordPress Classic Editor you must use the next shortcode:
[gif-player id="gif_id"]

If you don’t know the GIF ID you can add a GIF player using the “Add GIF Player” button next to the “Add Media” button.
When you click the “Add GIF Player” button the Media Library window will open and you will be able to select or upload your GIF.
When you save and view the post, the plugin will render the GIF Player according to the selected GIF Method in the plugin options page.
Gutenberg Block
You can use the GIF Player as a Gutenberg block. Check the wiki for more details.
Is compatible with Lazy Load?
Some Lazy Load plugins are compatible with the three GIF player methods in the plugin but there are other plugins that won’t allow you to reproduce the GIF player.
In case the GIF player cannot reproduce you can use your Lazy Load plugin filters to skip Lazy Load by using the GIF CSS classes.
The CSS classes for every GIF player are:

GIF: wp-gp-pp-gif
Canvas: wp-gp-pp-gif-canvas-player
Video: wp-gp-pp-video-player

If your Lazy Load plugin ask you to add a custom CSS class into the GIF asset to avoid Lazy Load you will have to use the GIF player custom filters in your functions.php file. Check the custom filters to avoid Lazy Load for the GIF players.
GIF as Video – Fallback
If for any reason your current GIF Player as Video doesn’t have any video source the plugin will render the default GIF Player (GIF) as fallback.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon