In PHPStorm is not properly loaded pictures and fonts, what to do?

The fact that in openserver, everything worked, but I decided to switch to PHPStorm. Installed interpreter configured everything but it does not work.
PHP files are run everything is OK. But the path to the files is defined differently
in openserver I just put for example: "../images/image.png" and it worked. Here the project is located in a separate folder but the path to that file is from ip addresses. Ie the path to that file should be this: "localhost:63342/project/images/slide1.png",
and he's like "localhost:63342/images/slide1.png"
Path to the draft: C:\Users\Даниил\PhpstormProjects\project
Structure:
index.php
images
pages/product.php <--- here is requested picture
June 3rd 19 at 19:00
1 answer
June 3rd 19 at 19:02
You just need to brush up on addressing URL

./ means look in the current directory.
.. / means to rise to a higher level and to look there.

Let's assume this structure (you its not shown, you have to wonder):

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


then you should write in index.html the address of the image:

<img src="./images/slide1.jpg">

and in styles.css:

.slide {
 background-image: url("../images/slide.jpg");
}


PS
Well, or if you know all this, it is possible to start the server not from the root folder of the project, and set up some internal.
I know all this, I request a picture from the folder and not from root. - jarvis_Anders commented on June 3rd 19 at 19:05
, well all right
you are here pages/product.php
../ rise above, get to the root
images/ - from the root is searched for a picture.

project folders in the path will not be and should not be, this document Ruth raised server, i.e. its root. - Lulu_Zulauf71 commented on June 3rd 19 at 19:08
this folder itself is created when you create the project.
But the root is considered to be the ip address while the root is the project folder - jarvis_Anders commented on June 3rd 19 at 19:11
you have confusion in my head =)
That's right, the root of this project. This folder will include DocumentRoot created server.
Similarly, you would have to OpenServer when you create the domain folder C:\Users\Даниил\PhpstormProjects\project and domain name, for example mysite.local. You would have the address to the picture http://mysite.local/images/image.jpg
Without any project

But I think I can guess where the Shoe pinches your delusion =))
You to open the server to create the domain without the tld, ie, not myproject.local, and just myproject in the address gleamed http://myproject/ and you thought this folder, although this domain name. As well as localhost:63345 domain name, specifying port. - Lulu_Zulauf71 commented on June 3rd 19 at 19:14
and do something to me what?))) - jarvis_Anders commented on June 3rd 19 at 19:17
The whole point is that in openserver, everything worked, and there is no - jarvis_Anders commented on June 3rd 19 at 19:20
Or not. Most likely you do not create domains in OSP, and just do subfolders for projects in localhost, then the project really was a folder and you have all worked.

What to do? In my opinion, obviously — you need to specify the correct path. And anyway, the way it is better to specify from the root of the server.
Here it is:

<img src="/images/slide.jpg">
or so

...
 <base href="http://my-super-site.ru/">


 <img src="images/slide.jpg">


In the second case, it is convenient to change the base address of all the URLs in one place. - Lulu_Zulauf71 commented on June 3rd 19 at 19:23
I created a domain in openserver - jarvis_Anders commented on June 3rd 19 at 19:26
Then something was done wrong.

in short, you specify data all is generated correctly and the path is correct, and you need to specify /images/slide.jpg/
The project folder root on the server and should not appear in URLs.

All. - Lulu_Zulauf71 commented on June 3rd 19 at 19:29
the point is that it is not considered as a root server, so to open the project:
localhost:63342/project/index.php?_ijt=b2kvqerlf7k...
While in openserver just localhost - jarvis_Anders commented on June 3rd 19 at 19:32

Find more questions by tags PhpStorm