Saturday, 9 March 2019

leaflet - Changing image size in JSON file



I am wondering how to change image size, available under the link in JSON file.


I base on the example:


http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanel.html


which uses a links to the icon, based on the web. This is obviously fine, although the linked image must have a certain size like:


"Logo": "http:\/\/mlb.mlb.com\/mlb\/images\/team_logos\/logo_atl_79x76.jpg",
"LeagueLogo": "http:\/\/mlb.mlb.com\/mlb\/images\/nl_75x75.png",


I have changed the link and put another one, so my JSON file (properties) currently looks like this:


"properties": {
"name": "PE1 5RX",
"MS_Ref": "REG/LYVELLYGDNS",
"Owner": "Long Term Reversions (Dulwich) Limited",
"Client_Ref": "LYVELLYGDNS",
"Address": "The Keep, Lyvelly Gardens, Peterborough",
"Postcode": "PE1 5RX",
"Units": 18,
"Logo": "https:\/\/www.cityfibre.com\/wp-content\/uploads\/2016\/09\/CF-

logo-New-Green.png",
"No_Under__H_Lease": 0,
"FH_Title": "CB331893",
"FH_Title_2": 0,
"Possible_Query__over__availablity": "No"
}

and attached logo is enormously big.


I tried to make sth like this:


"Logo": ""


But it doesn't work at all.


To make the graph running i need a rough URL in the quote.


How to change the size of this image to make it more adjusted to the particular map/website? Unless it's necessary to upload the smaller image on the server first and next link it to the JSON?


The logo, which I am interested in is under the link below:


https://www.cityfibre.com/wp-content/uploads/2016/09/CF-logo-New-Green.pngenter image description here



Answer



In your example, add width and height attribute to img element like shown below.


//place attributes in panel table.
var fieldA=document.getElementById('pict');

fieldA.innerHTML='';

with


//place attributes in panel table.
var fieldA=document.getElementById('pict');
fieldA.innerHTML='';

Your solution of changing to


"Logo": ""


will not work as in the code it is inside src attribute.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...