Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📢 必读公告 #261

Closed
XPoet opened this issue Oct 10, 2023 · 7 comments
Closed

📢 必读公告 #261

XPoet opened this issue Oct 10, 2023 · 7 comments

Comments

@XPoet
Copy link
Owner

XPoet commented Oct 10, 2023

  1. PicX 原来的默认图片链接规则 Staticaly https://cdn.staticaly.com 已经无法使用。
  2. 新的默认图片链接规则更新为 Statically https://cdn.statically.io,但是在中国大陆地区无法使用,需要 FQ。
  3. PicX 目前内置的 StaticallyjsDelivrGitHub 这三种图片链接规则,均需要 FQ 才能访问。
  4. 如你需要在中国大陆访问图片,请前往 我的设置 / 图片链接规则配置,手动切换链接规则为 ChinaJsDelivr
  5. 借助编辑器全局替换功能,可快速批量修改图片链接:
    • https://cdn.staticaly.com/gh/ -> https://cdn.statically.io/gh/ (需要翻墙访问)
    • https://cdn.staticaly.com/gh/ -> https://jsd.cdn.zzko.cn/gh/ (无需翻墙访问)
  6. 你也可以在 我的设置 / 图片链接规则配置 中,配置自定义的图片链接规则,然后使用你自己的规则。
  7. 作者正在积极探索更好友好且稳定的图片链接生成方式,敬请期待新版本上线。
image
@XPoet XPoet pinned this issue Oct 10, 2023
@XPoet XPoet changed the title 📢 必读公告 📢 ⚠️ 必读公告 Oct 10, 2023
@XPoet XPoet changed the title 📢 ⚠️ 必读公告 📢 必读公告 Oct 10, 2023
@dhay3
Copy link

dhay3 commented Oct 12, 2023

如果文件比较多,直接用脚本改方便多了,改成 github 的一劳永逸 😆

import re
import os

owner = ''
repo = ''
branch = ''
github = f'github.com/{owner}/{repo}/raw/{branch}'
staticaly = f'cdn.staticaly.com/gh/{owner}/{repo}@{branch}'
chinaJsDelivr = f'jsd.cdn.zzko.cn/gh/{owner}/{repo}@{branch}'
jsDelivr = f'cdn.jsdelivr.net/gh/{owner}/{repo}@{branch}'
basepath = ''


def redistribution(basepath):
    for root, dirs, files in os.walk(basepath):
        for file in files:
            if file and os.path.splitext(file)[-1] == '.md':
                filename = os.path.join(root, file)
                with open(filename) as f:
                    d = re.sub(f'{staticaly}', f'{github}', f.read())
                    d = re.sub(f'{chinaJsDelivr}', f'{github}', d)
                    d = re.sub(f'{jsDelivr}', f'{github}', d)
                with open(filename, 'w') as f:
                    f.write(d)


if __name__ == '__main__':
    redistribution(basepath)

@C2yb8er
Copy link

C2yb8er commented Oct 18, 2023

已解决图片失效的问题,给作者点个赞!

@cmty256
Copy link

cmty256 commented Dec 15, 2023

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

@XPoet
Copy link
Owner Author

XPoet commented Dec 15, 2023

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

@cmty256
没看明白,请描述清楚,并附带截图。你原来用的是哪中图片链接规则,更换成哪种?

@cmty256
Copy link

cmty256 commented Dec 15, 2023

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

@cmty256 没看明白,请描述清楚,并附带截图。你原来用的是哪中图片链接规则,更换成哪种?

就我把那三种链接规则都换成了ChinaJsDelivr,然后部署项目github page之后浏览器打开网站就看不到图片了,但是我本地的md文件是可以看到图片的。
image
image

@XPoet
Copy link
Owner Author

XPoet commented Dec 15, 2023

这种情况作者也不清楚,正常来说,你的图片链接能不能正常访问,只跟你网络环境有关。
建议你把图床部署到 GitHub Pages,然后把图片链接规则替换成 GitHub Pages

@XPoet
Copy link
Owner Author

XPoet commented Dec 15, 2023

@cmty256
另外,遇到问题,不要在此 Issue 评论,请新开 Issue。

@XPoet XPoet closed this as completed Feb 20, 2024
@XPoet XPoet unpinned this issue Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants