惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

记录生活,精彩一刻 - 图片

Typecho插件:ImageAccelerator文章图片加速 免费在线图片水印去除工具(kaze.ai) 工具网站推荐 - 鸭力巨大
Typecho 1.2.0 如何支持webp格式图片
Huo · 2022-09-04 · via 记录生活,精彩一刻 - 图片

Typecho 1.2.0 依然默认不支持.webp格式图片,实属拉胯。google 了一下,发现目前全网似乎还没有 Typecho 1.2.0 网站支持webp格式图片的教程。索性自己照着网上现有的 Typecho 1.0 网站支持webp格式图片教程,“摸着石头过河”,探索了一下 Typecho 1.2.0 支持 webp格式图片的教程。

Webp图片格式

具体步骤

  1. 找到 Typecho 网站所在文件夹下的以下文件:
var/Widget/Themes/Rows.php

差不多是第48行的位置;

将以下代码

return preg_match("/screenshot\.(jpg|png|gif|bmp|jpeg)/i",path);

修改为:

return preg_match("/screenshot\.(jpg|png|gif|bmp|jpeg|webp)/i",path);
  1. 保存修改后,找到 Typecho 网站所在文件夹下的以下文件:
var/Widget/Base/Contents.php

定位到第557行,将以下代码:

$value['attachment']->isImage = in_array($content['type'], ['jpg', 'jpeg', 'gif', 'png', 'tiff', 'bmp']);

修改为:

$value['attachment']->isImage = in_array($content['type'], ['jpg', 'jpeg', 'gif', 'png', 'tiff', 'bmp', 'webp']);
  1. 最后再找到 Typecho 网站所在文件夹下的以下文件:
var/Typecho/Common.php

找到图片格式所在的行,大约是在1259行后的位置添加下面这一行代码:

'webp' => 'image/webp',

最后进入 Typecho 网站后台,前往 设置 > 基本,在允许上传的文件类型部分,勾选其他格式,并添加webp,然后点击保存设置。

按照以上步骤完成修改后,后续新发布的文章将支持webp格式图片。