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

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Security Latest
Security Latest
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AI
AI
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
S
Secure Thoughts
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
V
V2EX
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tenable Blog
T
Threat Research - Cisco Blogs
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
Lohrmann on Cybersecurity
F
Full Disclosure
H
Help Net Security
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
O
OpenAI News
S
Securelist

记录生活,精彩一刻 - 格式

暂无文章

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格式图片。