I put an image file called x.png inside /public folder.
I try to access it through
<img src='/public/x.png> but the image doesn't show up. So I go to the url /public/x.png to check if it shows up, but all I see is a blank page with no errors both on client and server. I am really stuck. Does anyone know why this is happening? I also tried putting x.txt inside /public and accessing it via /public/x.txt, but all I see is a blank page.
/public is not part of the image URL, you can access to your image throught :
<img src='/x.png>
https://docs.meteor.com/#/basic/specialdirectories
The problem is with the URL of the image. If the image file is directly under public directory of Meteor, you can access it as
<img src="x.png">
If the image is in some other directory within public say public/something/img.jpeg then you can access it as
<img src="something/img.jpeg"
Related
I have a Razor view, and I'm looping through an object with an image URL among other things. The image is not found since, the server seems to add the localhost address to every image URL.
Like this: Database entry ImageUrl = img/shirts/blackshirt.png, but when inspected in the Console in the browser, the path becomes http://localhost:3000/api/img/shirts/blackshirt.png
Is there any way to change this? I have my images in wwwroot, like the pathway suggests. From the Razor view:
<img class="img-fluid" src=#product.ImageUrl alt="shirt">
The server isn't adding anything. The browser development tools will because it sees your image path as relative to the current request URL. Insert a forward slash before the URL to make it relative to the root of the website:
<img class="img-fluid" src="/#product.ImageUrl" alt="shirt">
I have an image stored in SPIFFS
When I launch the browser and put in the esp8266 IP address/images/image.jpg I can see the image. The image also shows in the index.html page in the root.
When I generate a page with
server.send(500, "text/html", "<head><title>esp8266</title></head><body><div id=\"banner\"><img src=\"/images/image.jpg\" width=\"900\" height=\"295\" /></div> <div id=\"page\"></body</html>");
The page does not show the image, just a image placeholder. AND I can no longer access the image via IP address/images/image.jpg. I'm thinking that server.send() changes the context of the root.
Thank You for any help.
First thing that I would do in this situation is try to serve that html page as a static file and see if it works. For example
server.serveStatic("/index.html", SPIFFS, "/static/index.html");
Or maybe this all happens just because of malformed HTML.
<div id=\"page\"></body</html>
I'm new to Joomla, but I've followed few tutorials. I've created a template for my website, but no images are showing up. Looking to the source, my image references look like:
<img src="/templates/fiziaimages/zdjecieDol.png" />
When they should be looking like:
<img src="/templates/fizia/images/zdjecieDol.png" />
^
fizia/images is the correct directory, so I don't know what causes the backslash to not appear.
in a first time you can use your browser inspector to verify if your images are really found.
If it's ok you can try to put your images in the "image" directory in the root of your website
It works fine when I dont use virtual folder. My virtual folder is named test which points to an application inside MyDocuments. The path to my App is
localhost\test\app\login.aspx
Note that if I move the application in the root folder wwwroot and make it an application, it works fine. I tried
<img src="logo.jpg" />
<img src="..\logo.jpg" />
<img src="~/logo.jpg" />
<img src="\\test\logo.jpg" />
Can it be fixed or should I leave it? My logo.img is in root folder of the application. I move it to \images\ folder as well still does not work.
There is a similar post here Relative Path in master page for img tag which did not solve my problem because it does not use Virtual Folder path.
Edit: I did used tag also and it did not work too.
<asp:Image ID="imgLogo" runat="server" ImageUrl="~/logo.jpg" />
Thanks in advance
Try adding runat="server" within the your html img contrl and select the src="" from the intellisense property of the visual studio.
or
Use Asp image server control instead of html img control and set the imageurl attribute from intellisense property of the visual studio.
Hope this will help you...
Use the asp:Image, it does all the hard work for you and gets rid of this kind of problem.
The ~/logo.jpg syntax only works in server controls, such as <asp:Image />. The ~ is then a shorthand for the root of your web-application.
If your 'test' directory is an application, then the logo should be there to be found.
To troubleshoot these kind of problems, you need to know the mapping between the physical location of your page ('login.aspx') and the url used to call it. A similar mapping will exist between the physical location of your image and the url you need to get it.
You could try to enter the url for that image directly in the browser. When you have a url that succeeds, you can figure out how to refer to that image from your page.
If it's in the same directory, a plain 'logo.jpg' will work. If elsewhere, you need to add some folderpaths ('images/logo.jpg' if it's in a folder named 'images' next to that page).
I had the same problem and above solutions worked for me.
I know this is old post.
In Masterpage all you have to do is
drag and drop Image
then go its properties and set the url (You can browse it from there)
Now all my pages have the logo with no issue of finding it.
I have a bunch of images in my localhost folder (C:\inetpub\wwwroot\Images) which I am trying to access within my ASP.net application. The image src generated in my markup is:
<img id="MainContent_MainImage" src="localhost/Images/FGOStuart_7166.jpg" />`
This fails to load the image and if I look at the source for the page it actually directs to
http://localhost:64395/Pages/localhost/Images/FGOStuart_7166.jpg
so it looks like it is trying to access a path relative to the page (on the Pages folder). The src works if I type it into the browser manually and the image is displayed.
Can anyone explain what's going on here and how to fix it? I'm attempting to move the images out of the database and onto the file system but without much luck so far.
That's because the browser assumes "localhost" is a folder and adds it to the current relative path. Add http to it and it should work fine, or remove localhost altogether and just leave the /Images... part.
Try it like this:
<img id="MainContent_MainImage" src="~/Images/FGOStuart_7166.jpg"
alt="An Image" runat="server" />
This resolves it server-side from the root down. And always use an alt :)
What you really want to be doing is using the magic tilde:
<img id="MainContent_MainImage" runat="server" src="~/Images/FGOStuart_7166.jpg" />
~ signifies the root of the application. Notice I added runat="server", too.