[WordPress] 外掛分享: PDF Thumbnail Generator

WordPress 外掛 PDF Thumbnail Generator 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「PDF Thumbnail Generator」是 2022-07-07 上架。
  • 目前有 1000 個安裝啟用數。
  • 上一次更新是 2024-09-12,距離現在已有 233 天。
  • 外掛最低要求 WordPress 3.0.1 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
  • 有 6 人給過評分。
  • 論壇上目前有 1 個提問,問題解答率 0%

外掛協作開發者

kubiq |

外掛標籤

pdf | image | creator | generator | thumbnail |

內容簡介

his plugin automatically generates a thumbnail for PDF files when they are uploaded to the WordPress Media library. It can also generate missing thumbnails or regenerate all thumbnails for old PDF files in the library. The Imagick library must be installed on the server for the plugin to function.

The plugin works on all types of WordPress installations, including domain, subdomain, subdirectory, and multisite/network, and is compatible with Apache and NGiNX servers. Users can set the maximum width, maximum height, image quality, and image file type of the PDF thumbnail.

The plugin also includes several shortcodes and functions that return information about the PDF thumbnail, such as the URL, path, image source, and image tag. Users can also use hooks to change the global PDF thumbnail settings for specific files.

Note: Please keep the original HTML tags as they are.

原文外掛簡介

Generates thumbnail for PDF file automatically after file is uploaded to the Media library.
You can also generate thumbnails for old PDF files that are already in the Media library – you can generate missing thumbnails or regenerate all thumbnails.
Imagick library must be installed on your server, otherwise this plugin will not work

automated test after plugin activation to make sure it will work on your server
works with all types of WordPress installations: domain, subdomain, subdirectory, multisite/network
works on Apache and NGiNX
automatically generate thumbnail for new uploaded PDFs
(re)generate thumbnails for existing PDFs in Media library
set maximum width of PDF thumbnail
set maximum height of PDF thumbnail
set image quality of PDF thumbnail
set image file type of PDF thumbnail

Shortcodes
pdf_thumbnail
Maybe you want to display PDF thumbnail by using a shortcode
[pdf_thumbnail id="123"]

pdf_thumbnail_url
Maybe you want to display PDF thumbnail url by using a shortcode
[pdf_thumbnail_url id="123"]

 
Functions
get_pdf_thumbnail_url
If you want to return PDF thumbnail URL you can use
get_pdf_thumbnail_url( $pdf_id )

it works similar to wp_get_attachment_url and it will return something like
https://site.com/wp-content/uploads/2022/01/example.pdf.png

get_pdf_thumbnail_path
If you want to return PDF thumbnail URL you can use
get_pdf_thumbnail_path( $pdf_id )

it works similar to get_attached_file and it will return something like
/www/site.com/wp-content/uploads/2022/01/example.pdf.png

get_pdf_thumbnail_image_src
If you want to return PDF thumbnail url, width and height you can use
get_pdf_thumbnail_image_src( $pdf_id )

it works similar to wp_get_attachment_image_src and it will return something like
[
0 => 'https://site.com/wp-content/uploads/2022/01/example.pdf.png',
1 => 600,
2 => 800
]

get_pdf_thumbnail_image
If you want to return PDF thumbnail image tag you can use
get_pdf_thumbnail_image( $pdf_id )

it works similar to wp_get_attachment_image and it will return something like
example

 
Hooks
pdf_thumbnail_max_width
Maybe you want to change global PDF thumbnail max_width for a specific PDF file
add_filter( 'pdf_thumbnail_max_width', function( $max_width, $pdf_id ){
if( $pdf_id == 123 ){
return 1024;
}
return $max_width;
}, 10, 2 );

pdf_thumbnail_max_height
Maybe you want to change global PDF thumbnail max_width for a specific PDF file
add_filter( 'pdf_thumbnail_max_height', function( $max_height, $pdf_id ){
if( $pdf_id == 123 ){
return 768;
}
return $max_height;
}, 10, 2 );

pdf_thumbnail_quality
Maybe you want to change global PDF thumbnail quality for a specific PDF file
add_filter( 'pdf_thumbnail_quality', function( $quality, $pdf_id ){
if( $pdf_id == 123 ){
return 100;
}
return $quality;
}, 10, 2 );

pdf_thumbnail_type
Maybe you want to change global PDF thumbnail file type for a specific PDF file
add_filter( 'pdf_thumbnail_type', function( $type, $pdf_id ){
if( $pdf_id == 123 ){
return 'png'; // or 'jpg'
}
return $type;
}, 10, 2 );

pdf_thumbnail_bgcolor
Maybe you want to change default PDF thumbnail background for a specific PDF file
add_filter( 'pdf_thumbnail_bgcolor', function( $bgcolor, $pdf_id ){
if( $pdf_id == 123 ){
return 'black'; // default is 'white'
}
return $bgcolor;
}, 10, 2 );

pdf_thumbnail_page_number
Maybe you want to PDF thumbnail page number for a specific PDF file
add_filter( 'pdf_thumbnail_page_number', function( $page, $pdf_id ){
if( $pdf_id == 123 ){
return 1; // default is 0
}
return $page;
}, 10, 2 );

pdf_thumbnail_filename
Maybe you want to PDF thumbnail filename for a specific PDF file
add_filter( 'pdf_thumbnail_filename', function( $filename, $pdf_id ){
if( $pdf_id == 123 ){
return str_replace( '.pdf.png', '.png', $filename );
}
return $filename;
}, 10, 2 );

pdf_thumbnail_imagick
Maybe you want to add watermark to PDF thumbnail for a specific PDF file
add_filter( 'pdf_thumbnail_imagick', function( $imagick, $pdf_id ){
if( $pdf_id == 123 ){
// add your watermark here
}
return $imagick;
}, 10, 2 );

get_pdf_thumbnail_image_attributes
Maybe you want to change attributes for image tag from get_pdf_thumbnail_image function
add_filter( 'get_pdf_thumbnail_image_attributes', function( $attr, $pdf_id ){
$attr['loading'] = 'eager';
return $attr;
}, 10, 2 );

pdf_thumbnail_generated
Maybe you want to do something after the thumbnail is generated
add_action( 'pdf_thumbnail_generated', function( $thumbnail_path, $pdf_id ){
// do somthing with the local file $thumbnail_path
}, 10, 2 );

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「PDF Thumbnail Generator」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.1 | 1.2 | 1.3 | 1.4 | trunk |

延伸相關外掛(你可能也想知道)

  • WP Sitemap Page 》透過這個 WordPress 外掛,您現在可以輕鬆將站點地圖加入到任何一個頁面中。只需要在您的頁面上使用簡碼 [wp_sitemap_page] 即可。這會自動生成您所有網頁和...。
  • FakerPress 》當您創建新的主題或外掛時,您總是需要創建自訂數據以測試您的外掛是否正常運作,作為開發人員,我們自己也遇到過這個問題。, 我們這個外掛的目標是填補這個...。
  • SMK Sidebar Generator 》這個外掛可以生成任意數量的側邊欄,然後讓你將它們放置在你想要的任何頁面。, , 特色:, , 無限數量的側邊欄。, 使用條件替換預設主題側邊欄,或全局替換只...。
  • Child Theme Wizard 》Child Theme Wizard 讓你在 WordPress 的管理介面中輕鬆創建子佈景主題,不需額外的工具。啟用後,你可以在「工具」-「Child Theme Wizard」中找到它。, 指定...。
  • WPS Child Theme Generator 》中文, WPS Child Theme Generator 是一款高級工具,可以輕鬆創建所需的子佈景主題。它提供許多選項,可以添加到 functions.php 中,而無需修改它。您也可以將...。
  • Heroic Favicon Generator 》“最佳的網站圖示外掛程式” ★★★★★ - WordPress.org 使用者評論。, 簡單強大的 WordPress 網站圖示外掛程式。, 使用 Heroic Favicon Generator 快...。
  • Simple XML Sitemap Generator 》XML Sitemap外掛可建立符合Google、Yahoo(以及Bing)要求的XML檔案。, , 只要安裝此外掛程式至WordPress,它便會自動運作。您只需要創建或更新任何文章或頁...。
  • Browser Screenshots 》使用 [browser-shot] 短代碼來自動化網站截圖的過程。一個圖示也會被加入 TinyMCE 編輯器中,以方便製作短代碼。, 外掛使用從 WordPress.com 取得的「mshots...。
  • AI WP Writer – best AI content generator, ChatGPT, GPT-4.1, Dalle 3, FLUX 》網站內容創作外掛使用 ChatGPT、GPT-4 及最佳神經網絡進行圖像生成,可快速有效填充網站。透過 AI WP Writer 外掛,您能輕鬆創建獨特、高品質和 SEO 最佳化的...。
  • Featured Image Generator 》您曾經為網站尋找特色圖片而感到困難嗎?這個外掛可以在 unsplash.com 等免費授權的優秀照片中搜尋,並在一個按鈕中將其導入到您的網站。該外掛包括圖層、色...。
  • PDF Thumbnails 》此外掛在媒體管理員中加入 hook,每當上傳 PDF 時就會產生縮圖。所產生的縮圖為所上傳文件中的第一頁圖像,並以 PDFNAME-thumbnail 命名,其中 PDFNAME 會被...。
  • EZ Form Calculator 》ez Form Calculator是一個直覺式的WordPress表單建立工具。輕鬆地建立表單計算器、進階成本估算器或全面的聯繫表單,讓你的網站更易獲取商機。利用ez Form Ca...。
  • Bulk Page Generator 》Bulk Page Generator 可以幫助您減少工作量並節省寶貴的時間。使用此外掛,用戶可以使用最簡單的用戶界面輕鬆創建頁面/文章,該界面提供了創建頁面/文章時必...。
  • QR Code Creator 》這是一個 WordPress 外掛,可幫助您建立 QR 碼。, 使用條款, 此外掛使用第三方服務(goqr.me)來建立 QR 碼。根據它的服務條款,它不會在任何給定的時間儲存...。
  • Remove Meta Generators 》這個外掛可以移除所有 Meta Generator HTML 標籤,包括 WordPress 核心自帶的 generator 標籤。安裝、啟用即可輕鬆使用,而後您的 HTML/源代碼中不再包含 Met...。

文章
Filter
Apply Filters
Mastodon