I just want to insert a picture into a asp.net page and this is how I proceeded ...
in the project i created an image folder and inserted the image there. in the html I use the img tag and enter the path to the image as src. In the browser I see that there should be a picture but it is not displayed. not even with the absolute path
Folder Structure....
<img src="\Images\file_example_PNG_500kB.png" />
Move the Images folder inside the wwwroot folder - that's where all static files are served from.
You should then be able to use an app-relative URL for the image:
<img src="~/Images/file_example_PNG_500kB.png" />
Related
I am attempting to use imported images in my .Net Project. I have placed the images in the images folder and they all have a plus sign and say "Pending add" next to them.
I'm not sure if this is the error or how I am referencing the images. I reference the image using the following code.
<img class="block" id="u730_img" src="Images/green9-crop-u730.jpg?crc=200722682" alt="" width="1529" height="659"/>
The image name is correct, but I'm not sure if that is the appropriate path. My folder structure is below. The file being used is LoginBody.cshtml and the image is in the images folder.
I suspect that you're using ASP.NET Core, and in newer version static files under wwwroot folder are served.
Move your images to wwwroot > images
and change your path:
<img class="block" id="u730_img" src="~/Images/green9-crop-u730.jpg?crc=200722682" alt="" width="1529" height="659"/>
Hope this helps !
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"
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
I creating new website using Umbraco(version 6.1.1 with razor) and I am new to Umbraco. My settings panel is like this.
In my Master template I am using my css styling and JavaScripts are like this. And their paths are ok.
<link rel="stylesheet" href="/css/mobile.css"/>
<script src="/scripts/jquery-2.0.2.js"></script>
CSS and scripts path are working. So that's ok.
Now my problem is I want images for my site. I don't know where to put images and what should be the path.
For example:
I tried to upload pictures to Media
In my Master template I tried
<img src="/media/A.jpg" alt="Smiley face" height="42" width="42">
<img src="/media/images/A.jpg" alt="Smiley face" height="42" width="42">
Also in the CSS file
background-image:url('/media/images/A.jpg');
But these are not working. I just trialing them. Actually I don't know the correct way of doing it :(
So where should I store images in Umbraco and how should I locate the path in CSS files and template files ?
Please help!
Thanks in Advance ....
Items stored in the media section will have a path like:
/media/<row_id>/filename.ext
Where <row_id> is literally the id of the row in the database where the media item's information is stored.
One way you can determine the path of the media item is to click on the thumbnail (if it's an image) and copy what is in the address bar.
You can also access the file by id via a macro using xslt or razor. Here's a razor example:
#{
int imageId = 1069;
var media = Library.MediaById(imageId);
<img src="#media.umbracoFile" alt="" />
}
However, this is a content management system, and you will no doubt have end-users managing the content and, therefore, it wouldn't make sense to place design specific images in the media section. A more full-proof approach would be to simply place them in an images folder in the root of your site and use them from there.
Should be as simple as this on your css:
.style { background-image: url(/media/1006530/A.jpg); }
The path you get from the media url with row id (e.g.1006530) in it
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.