Search code examples
cordovawindows-phone-7

Can't add image on Cordova 2.0


I'm working on a project on Cordova 2.0 and I don't know why but I can only use 1 image, the one in the hello world when you create a new project.

I'm using Visual studio 2010 with wp7 sdk and cordova 2.0 sdk.

Here an example of a simple code:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name = "format-detection" content = "telephone=no"/>
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" />

        <title>Hello Cordova</title>
    </head>

    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="example">
                <p class="hi">Hi guys !!</p>
                <p class="image"> This is the cordova image:
                    <img src= ./img/cordova.png />
                </p>
                <br />
                <p class="cat"> And this is a cat:
                    <img src= ./img/cat.png />
                </p>
            </div>
        </div>
    </body>
</html>

When I start my apps on wp7:

wp7screen

As you can see there is no cat...

My cat.png (64ko 170x200px) and cordova.png (20ko, 170x200px) are in the same folder of course.

The funniest part is that, in visual studio, you can see the design, and I can see my image:

visual studio design

I have no idea why the wp7 emulator doesn't want to display my image.

I tried to refresh it (because when I changed my applicationIcon, I needed to refresh it to see my new image) but nothing happened...

If someone has any idea / solution?

P.S: sorry for my English


Solution

  • To fix this error follow these steps

    1. From Soulion Explorer, right click the image and click Properties
    2. Select "Build Action", then select "Content"
    3. Save and Run
    4. Done