Jordan M
Jordan M

Reputation: 302

ASP Content Images not working

:(

Images are showing up fine when local:

enter image description here

but when I upload it to my server it doesn't like the link?

live demo

I saw some SO's that had similar problems and was told to "img src="~/..." but that's not working.

Here's my code:

<img src="~/Content/Images_fixed/@(item.link).scale_20.jpg" width=" 190" height="130" />

here's my content folder:

content folder

It shows "nothing" in folder but if I click 'show all' i see the images. All the images are in the folder as well so that's not the error (as you can see they load fine locally)

EDIT

you will see the images working on my server but that's only because I am using this <img src="http://www.jdmdev.net/sweetscomplete/images/@(item.link).scale_20.JPG" />

instead of <img src="~/Content/Images_fixed/@(item.link).scale_20.jpg" /> So my problem is still here it is not solved for some reason when you upload to your project it doesn't use same links, or possibly the images don't get uploaded(even though they appear on github just fine).

RESOLUTION

The cause: When you import images in visual studio, you need to 'include in project'. It will work locally, but once you put it on a live server it will no longer see the images. You must include in project, re-open visual studio and update your SVN that your server is retrieving the build from.

Upvotes: 0

Views: 106

Answers (1)

Jacek Zyśk
Jacek Zyśk

Reputation: 134

Try to include these images in your project, then try to publish your site. Maybe they are not uploading onto your server.

UPDATE: If you 'Show All Files' in your project in Visual Studio, and then 'Include in Project' all your images, then they will be added to .csproj file. Then you can commit your changes to github (including the .csproj file) and allow Azure to build your project and upload the files to your server.

Upvotes: 1

Related Questions