eighteen73/wordpress-thumbor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eighteen73/wordpress-thumbor

最新稳定版本:v0.2.0

Composer 安装命令:

composer require eighteen73/wordpress-thumbor

包简介

A WordPress plugin to serve media via a Thumbor server

README 文档

README

This plugin is in early development and may yet undergo changes that affect its functionality. Use it at your own risk until we publish a versioned release.

This plugin modifies Wordpress image URLs so they can be served from Thumbor.

A well configured Thumbor server can deliver highly optimised images to improve website load times, and take a large of your web server by removing the need for WordPress to generate image derivatives for itself.

Prerequisites

You need access to a Thumbor service to use this plugin.

Note this typically only works on remote WordPress websites because Thumbor needs web access to the uploaded images. With some environment configuration you may be able to make it work in a development environment but that setup is outside the scope of this plugin.

Installation

Install and activate the plugin as normal then add the following configuration to your website.

define( 'THUMBOR_URL', 'https://media.example.com' );
define( 'THUMBOR_SECRET_KEY', 'your_thumbor_secret_key' );

If you Thumbor server runs in unsafe mode (which is highly discouraged) you may set THUMBOR_SECRET_KEY to null.

Optional: Disabling “big image” resizing

WordPress can automatically resize large image uploads which will save unnecessarily large requests from your Thumbor server. This plugin can change that limit with the following configuration.

# Disable “big image” resizing
define( 'THUMBOR_UPLOAD_IMAGE_THRESHOLD', false );

# Set the longest image edge
define( 'THUMBOR_UPLOAD_IMAGE_THRESHOLD', 2000 );

See big_image_size_threshold docs for more information.

Optional: Allow image upscaling

By default image upscaling is disabled. However we have had the occasional need for this, so to enable this feature you can use this filter in your theme:

add_filter('thumbor_allow_image_upscaling', '__return_true');

Optional: Delete prior image files

Once the plugin is enabled you can make use of a WP-CLI command to delete any image derivatives that have already been created.

Use this command with great care because it will delete media files from your server.

wp media regenerate

Deactivating/pausing the plugin

The plugin automatically deactivates itself when THUMBOR_URL is not set. So in your development environment you can remove the above configuration to make WordPress return to its default behaviour.

While enabled the plugin has prevented WordPress from making it's own resized versions of images. You can use the following WP-CLI command to generate any missing images after disabling the plugin:

wp media regenerate --only-missing

Credits

This plugin is heavily based on code that was forked from the Tachyon plugin by Human Made. All due credit to the authors of that plugin.

统计信息

  • 总下载量: 597
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-26