使用Flask-FlastPages插入图像 [英] Inserting images using Flask-FlastPages

查看:39
本文介绍了使用Flask-FlastPages插入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Flask-FlatPages创建了我的博客,这些帖子位于Markdown中,我面临的挑战是在博客文章中插入图片.在markdown中插入图像的传统方法不起作用.

I have created my blog using Flask-FlatPages and the posts are in Markdown, the challenge I'm having is inserting images in my blog post. The traditional way of inserting images in markdown is not working.

我也尝试了这个但没有成功:

I also tried this without success:

![image]({{ url_for('static', filename="img/my_image.jpg") }})

推荐答案

这是一个快速解决方案!假设我们有一个images文件夹,我们想使用 images/flower.jpg

Here is a quick fix! let's say we have a images folder, and we want to use the images/flower.jpg

第1步:将 images 文件夹放在 static 文件夹中.

Step 1: Put the images folder in the static folder.

第2步:在文本中,将图像与 ../static/images/flower.jpg 链接.

Step 2: In the text, link the image with ../static/images/flower.jpg.

例如:

![flower](../static/images/flower.jpg)

<img src="../static/images/flower.jpg" alt="flower">

这篇关于使用Flask-FlastPages插入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆