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

Vapor 3 cannot load image and css from Public images (images resources) and Public styles (css resources) #1629

Closed
nhatlee opened this issue Apr 18, 2018 · 5 comments
Projects

Comments

@nhatlee
Copy link

nhatlee commented Apr 18, 2018

Steps to reproduce

I load a leaf file with content is html, html content load image like below:

<div class="title">My's Homepage</div>
<p><a href="images/nhatle.jpg">
<img align="right" width="204" height="153" src="images/nhatle.jpg" alt="photo">
</a></p>

I have image with this name into folder Public->images

Expected behavior

Should display image on the website

Actual behavior

screen shot 2018-04-18 at 9 28 49 pm

Environment

I use Swift 4.1

  • Vapor Framework version:3.0 beta
  • Vapor Toolbox version: Vapor Toolbox: 3.1.4
  • OS version: 10.13.4
@nhatlee nhatlee changed the title Vapor 3 cannot load image and css from Public │ ├── images (images resources) │ ├── styles (css resources) Vapor 3 cannot load image and css from Public images (images resources) and Public styles (css resources) Apr 18, 2018
@nhatlee
Copy link
Author

nhatlee commented Apr 18, 2018

Here is the folder structure of my project:
screen shot 2018-04-18 at 9 31 35 pm

@vzsg
Copy link
Member

vzsg commented Apr 18, 2018

Did you enable the FileMiddleware by uncommenting this line?

@nhatlee
Copy link
Author

nhatlee commented Apr 18, 2018

I am not change the configure file. So it comment out by default when I create new project.
Thanks so much for your help.

@bellebethcooper
Copy link

I also had this problem because I missed that I needed to uncomment that line. Maybe it would be worth mentioning this in the docs about using Public for serving files?

@0xTim
Copy link
Member

0xTim commented Jan 5, 2019

Sounds like a worthy PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Vapor 3
  
Awaiting triage
Development

No branches or pull requests

5 participants