How to get Latitude and Longitude from Country or city using PHP


How to get latitude and longitude from address in php
You can use country name for get Latitude and Longitude and also use full address instead of city or country

$address = 'india';

Or also you can use CIty name for get Latitude and Longitude

$address = 'Junagadh';

Or you can also use city, state and Country togther.

$address = 'Junagadh+Gujarat+India';

There are two method for get Latitude and Longitude

First is :

$details_url = "".$address."&sensor=false";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $details_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = json_decode(curl_exec($ch), true);

if ($response['status'] != 'OK') {
	return null;


$latLng = $response['results'][0]['geometry']['location'];

$lat = $latLng['lat'];
$lng = $latLng['lng'];	

Second method is:

$geocode_stats = file_get_contents("");

$output_deals = json_decode($geocode_stats);

$latLng = $output_deals->results[0]->geometry->location;

$lat = $latLng->lat;
$lng = $latLng->lng;	

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to apply lightbox in tt_content images


To open the tt_content images with lightbox you have to set the below typoscript in your TS template.
Before the you must have to install “perfactlightbox” extension and include in template.

tt_content.image.20.1.imageLinkWrap >
tt_content.image.20.1.imageLinkWrap = 1
tt_content.image.20.1.imageLinkWrap {
	enable.override = 1
	# Add new typolink wrapping code
	typolink {
		target =
		title.field = imagecaption
		parameter.cObject = IMG_RESOURCE = TSFE:lastImageInfo|origFile
		parameter.cObject.file.maxW = 800
		parameter.cObject.file.maxH = 600
		# Add the “rel” attribute needed to activate the lightbox effect.
		# This assumes you want slimbox to be navigable
		ATagParams = rel=”lightbox[sb{field:uid}]” class=”lightbox”
		ATagParams.insertData = 1

After set this typoscript. you can go to content element and check the checkbox of “Enlarge on Click” and “Lightbox”.
Then after it will work fine.

If you have any query then feel free to contact me at Jainish Senjaliya