D
D
Daniil Sukhikh2018-07-23 04:27:01
phpstorm
Daniil Sukhikh, 2018-07-23 04:27:01

Pictures and fonts are not loading correctly in PHPStorm, what should I do?

The fact is that everything worked in openserver, but I decided to switch to PHPStorm. Installed the interpreter configured everything but does not work.
PHP files run ok. But the paths to the files are not defined in the same way,
in openserver I just set it like this: "../images/image.png" and everything worked. Here the project is located in a separate folder and the file path is considered from the ip address. That is, the file path should be like this: " localhost:63342/project/images/slide1.png ",
and it's like this: " localhost:63342/images/slide1.png "
The path to the project: C:\Users\Daniil\PhpstormProjects\ project
Structure:
index.php
images
pages/product.php <--- image is requested from here

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2018-07-23
@delphinpro

You just need to brush up on URL addressing
./ means to search in the current directory.
../ - means to go up a level and search there.
Suppose the following structure (you didn’t show yours, you have to guess):

project/
|-images/
| |
| \-slide1.jpg
|
|-css/
| |
| \-styles.css
|
\-index.html

then you should write in index.html the following image address: and in styles.css like this:
.slide {
  background-image: url("../images/slide.jpg");
}

ZY
Well, or if you know all this, then you probably do not start the server from the root folder of the project, but set up some kind of internal one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question