Displaying An Image In Browser Widget.

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Displaying An Image In Browser Widget.

Post by Googie85 » Mon Jul 05, 2021 10:00 am

Hi Guys!

This is my third post in as many days and I hope I'm not annoying anyone! I was trying to scale an image to fit the screen on my Android device and from the example I was given it seems it is a bit over my head and not as easy as I thought it would be. I have come up with an even better way to achieve my goal and this idea is more preferred as it has an added bonus. The idea, is to display an image inside a Browser Widget and have the added feature of being able to pinch to zoom on the image also. I have tested and got the image to display using the following simple html code.

Code: Select all

<html>
<head>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .imgbox {
            display: grid;
            height: 100%;
        }
        .center-fit {
            max-width: 100%;
            max-height: 100vh;
            margin: auto;
        }
    </style>
</head>
<body>
<div class="imgbox">
    <img class="center-fit" src='./BIRD.jpg'>
</div>
</body>
</html>
When I point the htmlText of the Browser Widget to this html page, it works perfectly for my needs. The image is displayed "Scaled" to the Browser Widget. Now, here is my question, how would I point the "./BIRD.jpg'" portion of the html code to be able display an image from the specialfolderpath("documents") directory where the BIRD.jpg file is located? (Also, the html file is name index.htm and is also located in the same "documents" folder.

Would it even be possible to point the BIRD.jpg portion of the html file to a "documents" folder? I have tried many different options in the past day and have had no luck. I hope I have been able to explain this clearly. :(

Any ideas are warmly welcomed!

Googie.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”