Visual Studio 2008 Web Project problem with PNG files - visual-studio

I've added a PNG file to a directory in my VS2k8 webforms project, and when I run the app, it refuses to render my image - it even knows the dimensions but renders a box with a red X.
Oddly enough, if I double click the PNG file within VS2k8, it opens up in the IDE and displays fine (but only within the IDE).
Does anyone have any clues?
The path is correct.. I just have a basic default.aspx page with this in the body
<img src="img/logo.png" />
if i navigate to img/logo.png in the browser, it shows a box with the same dimensions as my image, but a red x. Its finding the image, just not rendering it. It's showing up in IE running under the vs2k8 web server (localhost:5512/default.aspx)
I've dropped a JPG in the same directory, and it shows up just fine.
I'm not sure what type of PNG it is, but here is the kicker.... If i make an HTML file that references that image, copy both this HTML file and PNG file to my webserver (or just double click on the HTML page), it comes up JUST FINE.
Its leading me to believe that the Visual Studio web server may not recognize PNG files (at least this one) properly?

Try changing the path to:
<img src="/img/logo.png" />

Try to use Firebug on the running page. It will let you change the path dynamically so that you can see if there is a problem with the path. Alternatively you can also just copy your dev path, say "http://localhost:<someport>/img/logo.png" and see whether it loads there.
As a third alternative you could use the <asp:Image id="imageLoge" runat="server" ImageUrl="..."/>. The advantage is that it will let you browse in the folders and select your image. In this way you're guaranteed that it is not a problem with your path.

Related

/public/img/ folder not acceping new assets in Go-compiled web app

I downloaded a binary via docker for the Gogs project (https://github.com/gogits/gogs), set it up (via docker pull gogs/gogs) and the server works as expected. Now I'm trying to customize the html a bit to look consistent with our company's other tools. When looking at deployed project, the assets of interest are in the following directories:
public/img/*.png
public/css/*.css
templates/*.tmpl
When I update the css, changes take effect right away, when I update tmpl, I need a container restart (implying that html is generated at server start time), when I update anything in public/img/ directory, however, I can't seem to get those assets used at all and I'm clueless about what's happening since most web servers/frameworks treat public/img/ as a static directory with all of its contents publicly visible by default.
Here is what I've tried so far and the outcomes:
Action: copied a new favicon image (my_favicon.png) into public/img/ and changed /templates/base/head.html to point to it (/img/my_favicon.png) instead of the original (/img/favicon.png), left original untouched and restarted the container.
Result: page loads with broken image icon, DOM inspector says that it's pointing to /img/my_favicon.png but doesn't show the image, going to that URL directly doesn't show the image either.
Action: change .tmpl back to point to original image (/img/favicon.png), overwrite original with the new image. I tried this with the main lg-gogs.png logo too.
Result: page loads with broken image icon just like before.
A grep search for image name revealed that only the .tmpl I modified and config.codekit are mentioning it (and I'm not at all familiar with CodeKit, but the instructions claim that it's only relevant for git, not me, and to leave the file alone, although it seems to profile names and sizes of all images - however I don't see anything else on the server reference this codekit file).
I have no idea why changes to css and tmpl work fine, but images cause this unexpected result. Does anyone have an idea of what's going on, why the server isn't accepting the images?

Dreamweaver Zip, not locating files correctly

I've created a website in Dreamweaver that consists of images and pages. You can navigate through the pages via a taskbar and the images are viewable on certain pages. It all works fine on my local laptop but, when I zip the file and try to open it from my desktop computer, the text comes up but all of the images and links are broken.
Is there anyway I can fix this without restarting my whole website?
You need to unzip your files first. That's where your problem is.

broken image in chrome and firefox works in safari

I have a logo that shows up in Safari but in Chrome it appears as a broken link and simply does not show up at all in Firefox.
<img src="images/logo-01.png"/>
I have re-uploaded it many times and have even tried alternative paths and file names.
anyone know how i might be screwing this up?
I ran into this same problem. For me, it turns out the image was corrupt. If i tried to open the png file up in photoshop, i would get an error saying it could not parse the file.
For whatever reason, safari could display the corrupt file, but chrome could not. This is how i fixed my issue. I noticed "preview" on my macbook could open the file fine. If you are using windows, possibly try paint or gimp or some other program besides photoshop.
I downloaded the corrupt file onto my macbook, opened it with preview (open with > preview)
In the preview app, go to file > duplicate, which makes a copy of your image
Save that duplicated image
As a test, i tried opening that new copied image in photoshop and i was able to!
Upload new file to website. I was able to view the image in chrome now.
Hope that helps anyone who ran into the same problem.
It could be an issue with your file structure. Right now your links are using relative paths (e.g. href="index.html"). This is fine if the file you're referencing is in the same directory as the current page file. But if your current page is located elsewhere, like in a 'pages' directory or something, then you need to tell the links to start from the site root. That would look like href="/index.html" (note the slash). So for the image, you'd have:
<img src="/images/logo-01.png"/>

Phonegap on WP7 does not load images

I'm starting my first PhoneGap project and am developing using Visual Studio and Windows Phone 7, although I intend on ultimately deploying to iOS and Symbian as well.
However, I'm stuck at Step 1. I have added an image to the www/images folder, and put the following code:
<img src="images/login-btn.png" width="103" height="42" style="margin-left:90px;" />
And I get:
It works fine when I preview it in IE9, but I don't have a Mac to test it on iOS yet.
It's worth noting that the JS files and CSS have loaded fine, it's just any image (whether referenced in CSS or an <img> tag) always comes up broken.
My guess would be the Build Action of your image file is incorrect.
According to http://wiki.phonegap.com/w/page/48672055/Getting%20Started%20with%20PhoneGap%20Windows%20Phone%207#4Reviewtheprojectstructure section 4. You should be setting the Build Action of your images etc to Content which simply copies them into the output project when it is built. They are probably currently set to Resource or None.
To change the Build Action right click a file and choose properties to go to the properties window if you do not already have it open. It is probably then the first property. Just click and choose the correct one.
I'm posting this to questions that I found while trying to find my answer to the same problem. The JS framework I use adds a url query to each image when in a debugging mode (in order to force browsers to reload image, instead of using cached). So, my image "image/background.jpg" would be accessed as "image/background.jpg?d=34342233". But, when running on PhoneGAP for Windows Phone, it won't recognize the image, and thus it shows up as broken. So, I had to turn off debugging for the framework I use, and suddenly the images showed up (still, don't forget to set the Build Action to "Content" as mentioned earlier).

Image not showing IE(all the versions)

i tried all the versions of ie but it is not showing only 1 image.
<asp:Image ID="img" runat="server" ImageUrl="~/images/FlorDecor.jpg" BorderColor="AliceBlue" BorderStyle="None" Height="126px" Width="90px" />
i tried placing this image outside the folder and giving
url = "FlorDecor.jpg"
url = "../FlorDecor.jpg"
url="~/FlorDecor.jpg"
i tried all this stuff pls help me..
Your URL references were not all valid in Silverlight (should have been "images/FlorDecor.jpg" if the file is in the images folder of your Silverlight App).
Silverlight uses different URL methods depending on whether the image is in the Silverlight project or somewhere on the source website (or an external site).
If the problem persists the cause is more likely that your JPG is not compatible for some reason.
Convert it to a PNG with Paint.Net or similar to test that theory, or just grab another JPG from the Internet instead.
Do not use .jpg file, use .png. It will works.

Resources