无法在玉石中显示静态图像

时间:2017-10-20 12:05:13

标签: node.js express pug

我无法显示图片,图片位于同一个文件夹中。

  each user,i in users //users data loop
    h2=user.name
    .card
      img(src='img_rr_01.jpg', alt='Avatar', style='width:100%') // Image 
      |   
      .container
        h4
          b=user.email
        |  
          p=user.name 

3 个答案:

答案 0 :(得分:0)

通过提及类似的内容确保您指定公共资源文件夹 -

{__esModule: true, Library: ƒ}

然后,静态文件的路径通常应以Sub GroupCertainShapes() Dim x As Long Dim sTemp As String Dim aShapeList() As String Dim lShapeCount As Long With ActivePresentation.Slides(1) ' iterate through all shapes on the slide ' to get a count of shapes that meet our condition For x = 1 To .Shapes.Count ' Does the shape meet our condition? count it. If .Shapes(x).Type = msoAutoShape Then lShapeCount = lShapeCount + 1 End If Next ' now we know how many elements to include in our array, ' so redim it: ReDim aShapeList(1 To lShapeCount) ' Reset the shape counter lShapeCount = 0 ' Now add the shapes that meet our condition ' to the array: For x = 1 To .Shapes.Count ' apply some criterion for including the shape or not If .Shapes(x).Type = msoAutoShape Then lShapeCount = lShapeCount + 1 aShapeList(lShapeCount) = .Shapes(x).Name End If Next ' and finally form a group from the shapes in the array: If UBound(aShapeList) > 0 Then .Shapes.Range(aShapeList).Group End If End With End Sub 开头,然后按照公共文件夹中的路径进行操作。例如如果您的图片位于app.use(express.static(path.join(__dirname, "/../public"))); 文件夹中,请将/更新为public/images

请注意,您无需在src中提及src文件夹。

答案 1 :(得分:0)

Express不会提供您未经许可的任何内容。您必须使用express.static中间件授予权限。

  

要提供静态文件(如图像,CSS文件和JavaScript文件),请使用Express中的express.static内置中间件功能

有关详细信息,请参阅https://expressjs.com/en/starter/static-files.html

答案 2 :(得分:0)

如果app.js中包含以下内容,则可以直接指定存储图像的文件夹。

app.use(express.static(path.join(__dirname, 'public')));