Viewing jpg in a LC field

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
glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Viewing jpg in a LC field

Post by glenn9 » Fri Jan 22, 2021 4:30 pm

Hi,

I'm trying to learn how to access Map APIs with some initial success but having difficulties in trying to put a map area into a field.

This code generates a map area as a jpg in a desktop browser and works as expected in generating the jpg which can then be viewed in the browser.

Code: Select all

put "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" & tLat & comma & tLon & "/9?mapSize=500,500&pp=" & tLat & comma & tLon & ";66;&key="&tBMKey into tURL
launch url tURL
and I get a small map extract showing in the browser as below. .

Is there a way of putting the jpg into a LC field for viewing, or will the user always have to be directed to the browser??

Many thanks,

Regards,

Glenn
Attachments
Test.jpg
Test.jpg (34 KiB) Viewed 2152 times

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Viewing jpg in a LC field

Post by Klaus » Fri Jan 22, 2021 5:06 pm

Hi Glenn,

you can use -> imagesource
Check the dictionary for further info, basically this "replaces" a character in a field with an image.


Best

Klaus

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: Viewing jpg in a LC field

Post by glenn9 » Sat Jan 23, 2021 9:40 am

Hi Klaus,

Many thanks, all worked perfectly.

I can't believe how straightforward it was to implement this, it was literally a case of typing a character in the empty field and then applying the imageSource code:

Code: Select all

put "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" & tLat & comma & tLon & "/9?mapSize=228,131&pp=" & tLat & comma & tLon & ";66;&key="&tBMKey into tURL
launch url tURL
set the imageSource of char 1 of fld"fTest" to tURL 
Not sure how other languages solve this problem but I think its marvellous that LC can do it in essentially one line of code!

Thank you again,

Regards,

Glenn

Post Reply