Slimbox2 Slideshow v1.2 – support for WordPress Gallery Captions

December 14th, 2011

Slimbox2-Slideshow version 1.2, a WordPress plugin is released, now supports displaying WordPress Gallery Captions in the lightbox.

Download it from the WordPress Plugin Directory

Remember to enable “Link thumbnails to: Image File” on the WordPress Gallery settings page.

Related posts:

  1. Slimbox2 Slideshow v1.1 – support for WordPress Gallerys
  2. Slimbox2 Slideshow – WordPress plugin to add image lightbox and slideshow
  3. thydzik Google Map v1.4.7 – inline WordPress Google Maps

The Cool Cube featured in 10 Years of Mini-ITX eBook

November 30th, 2011

To celebrate 10 years of the VIA Mini-ITX motherboard, VIA had released a anniversary eBook titled Small is Beautiful: Ten Years of Mini-ITX, which features one my case modding projects, The Cool Cube.

Head over to viamini-itxebook.com to read about it and many other cool mods.

Ten Years of Mini-ITX eBook

Correspondence with Property Manager LJ Hooker Belmont WA – Tenant Maintenance

November 20th, 2011

Less than a fortnight after the property was tenanted,  property manager LJ Hooker Belmont WA sends me an email;

“The tenant has informed me that crackling noises are coming from the power point in the main bedroom when plugging any appliances in.  Also light/fan to dining is blinks and switches off after a while.  Can I send an electrician.”

They send a second email replying to my request for a quote for the work;

“The approximate amount is $350 + GST, just to replace a power point is $140 + GST, just to buy a fan is also approximately $130.  Labour is $99 per hour.  But the approximate amount to do the job is $350+ GST

Expensive, I thought, luckily I had a relative that I could use to perform the repairs.

Strangely, in the same emails, LJ Hooker Belmont WA informs me the tenant does not have a front door key, that’s interesting as section 5.3.8 of the Exclusive Management Authority for Residential Premises Terms and Conditions, states “the agent will arrange for any device or keys to the Premises to be provided to the Tenant for the purposes of entering the Premises”.  Odd that I was informed this after the tenant had already signed the lease, maybe a backdoor key was all that was required.

Related posts:

  1. Correspondence with Property Manager LJ Hooker Belmont WA – Introduction
  2. Correspondence with Property Manager LJ Hooker Belmont WA – Maintenance
  3. Correspondence with Property Manager LJ Hooker Belmont WA – First Tenants

Slimbox2 Slideshow v1.1 – support for WordPress Gallerys

November 16th, 2011

Slimbox2 Slideshow has been updated to automatically at the rel=’lightbox’ tags to WordPress Gallerys.

Download it from the WordPress Plugin Directory

Remember to enable “Link thumbnails to: Image File” on the WordPress Gallery settings page, and

to enable “Automatic Gallery Image Link Tagging” on the Slimbox2 Slideshow Options page.

Related posts:

  1. Slimbox2 Slideshow – WordPress plugin to add image lightbox and slideshow
  2. Slimbox2 Lightbox clone with automatic image resizing
  3. thydzikGoogleMap v1.5 – an inline Google map plugin for WordPress

MATLAB Scaled Image Normalized Cross-Correlation

November 11th, 2011

A few week’s ago I got reacquainted with an old friend MATLAB, to solve a computer image manipulation problem.

When I blog about my travels I liked to Geocode my photos and reference them on a Google Map with a marker (see here), on the photo thumbnail I had previously stamped a circle marker on the lower right corner referencing the Google Map marker (the examples below will explain it better). I decided to move away from this approach and dynamically add these circle markers with a CSS and JavaScript solution, as this was a lot cleaner.

The problem, how do I remove the circle markers from my thumbnails, without having to re-crop every single one of my photos. It is fine for landscape photos, all image programs could batch resize the thumbnail from the full size photo, but what about portrait photos, each thumbnail was a cropping of the full size photo. I could assume either the top, vertical centre or bottom of the photo, but that would most likely be different to the original thumbnail and may miss the detail of the full size photo.

The solution was Normalized Cross Correlation, MATLAB already had an example that worked well if the cropped image had not been resized, but I needed something that would allow for resized thumbnails.

My crude solution, loops from smallest to largest sized cropped thumbnails and records the maximum peak of the normalized cross correlation, the maximum would then correspond to the correct scaled image size. This worked well, though the only issue was speed, I managed to optimise the speed by stepping the size in 6 pixel intervals, I also decrease the size of the full sized photo to shorten the number of iterations.

I have called the function cropxcorr, input Template takes in the thumbnail image, input A takes in the full size image, returns C a cropped image mirroring the thumbnail image.

There is also a MATLAB script I ran to loop through the files, portrait images will be passed with cropxcorr, landscape images simply resized.

You can download the MATLAB code and see the examples below.

cropxcorr.m

image-loop.m

Example 1
Thumbnail with marker
Example 1 thumbnail with marker
Original full sized image
Example 1 original full sized image
Generated thumbnail with no marker
Example 1 thumbnail with no marker
Example 2
Thumbnail with marker
Example 2 thumbnail with marker
Original full sized image
Example 2 original full sized image
Generated thumbnail with no marker
Example 2 thumbnail with no marker
Example 3
Thumbnail with marker
Example 3 thumbnail with marker
Original full sized image
Example 3 original full sized image
Generated thumbnail with no marker
Example 3 thumbnail with no marker

Related posts:

  1. Slimbox2 Lightbox clone with automatic image resizing
  2. Slimbox2 Slideshow – WordPress plugin to add image lightbox and slideshow

Planning a wedding reception and Tawarri Reception Centre review

November 3rd, 2011

Having recently executed a very successful wedding reception, I thought I would share my experience, and also provide a thorough review of Tawarri Reception Centre.

It all started September 2010, we got married and decided we must have a reception next year.  We browsed through a number of well known venue brochures, Matilda Bay Restaurant, Fraser’s Restaurant, Old Brewery and off course Tawarri.

They were all in nice locations, overlooking the Swan River, but what drew us to Tawarri was the classic venue that our parents had at least once been to, but even more so, the price.

At the time, Tawarri advertised a three course sit-down meal for $79 per person off-peak, which included a five hour beverage package of wine and spirits, it all sounded too good to be true. We checked out the venue, met with Malcolm Fernandez, who was already keen on sharing his wedding ideas, and paid the $1000 deposit.

We didn’t do too much till early next year, where the missus and I started bouncing ideas for the general ‘theme’, invitations and guest list. We decided that the invitations should tie-in with the final reception.

Invitations

Having decided on the invitation font, design and wording, time to purchase the materials;

  • 100x 6” square white envelopes $20 AUD
  • 100x 12” square Bazzill embossed cardstock $120 USD

By late May material had arrived, and by June approximately 80 invitations posted.

I also made a simple online paperless invitation, which mimicked the real invitations.

Wedding Website and Online RSVP

In parallel to the invitations, an Online RSVP form was made and a basic Wedding Website.

Package Update

On May 2011, Lee-ann from Tawarri sent through an update reception package brochure, our original sit-down meal for off-peak had increased from $79 per person to $84 per person, a 6.33% increase. Note; the Australia consumer price index (CPI) from September 2010 to June 2011 was only 3%.

From May 2011 was when the real reception planning started, it was amazing how little information Tawarri provided in their reception package brochure, we asked many questions, here are a list of key items that were discussed leading up to the reception, most are relevant to Tawarri, but for completeness, I have still shared those that are not.

Chair Covers

Tawarri was able to provide chair covers with sashes for $5.50 per person plus a $1.00 per person set up fee. The least expensive I could find chair cover only in Perth was $4.50 per person. Looking at other options, there is a “universal’ chair cover available that fits on all chairs and ties neatly behind the back of the chair, so no sash is required. I managed to located satin universal chair covers for $3.60 (including postage) to purchase from a seller on Alibaba (contact Jean Zhu; elegancetextile002@gmail.com)

Bottled Beers

Tawarri’s standard beverage consumption was jugs of Carlton Draft and Carlton Mid-Strength, now when I think of beer jugs, I think of my university days, not something I want at a wedding reception, so I thought bottled beers were the way to go. Tawarri do offer a bottled beer package for an extra $15 per person, with “conditions apply”. In a separate document which you have to request, the first paragraph states the following;

“our experience with alcohol service has indicated a dangerous trend of binge drinking at functions resulting in unsavoury behaviour and incidents that jeopardise the safety of staff and guests. Bottled beers will not entirely replace jugs of draught beer and will be served in addition to the standard option”

Here’s an interesting fact Carlton Draft contains 4.6% alcohol content, Corona also contains 4.6% alcohol content, the difference is one is served in a 1136mL jug, the other in a 330mL bottle.

Wedding Cake Service

At our first meeting with Malcolm, he informed us of Tawarri complimentary wedding cake service, on questioning later, it turned out it was merely cutting the cake up to finger size pieces and serving it on a platter in the middle of the table. This was still nicer then what some of the other venues would charge for this service, and we decide to go with this option.

Beverages

Included in the standard package were Hardy’s Cabernet Merlot and Hardy’s Chardonnay  wine, Carlton Drought and Carlton Midstrength beer and soft drinks.

I was against having jugs of beer at our tables, I didn’t think they were appropriate for a wedding. Unfortunately, there was no option to remove them, and the bottle beer package wasn’t a substitute, but added more to the table.

Bar Tab

It is common for venues to have a bar with can either be guest paid or prepaid for the night. Tawarri had this, on May they provided us with current bar prices, again in a separate document. On July they informed us of revised prices for spirits and bottled beers, a slight fifty cents increase.

I decided to go with an unadvertised open bar, except for three drinks on the menus, Coronas, Johnny Walker Black and Gin and Tonic. One of the ideas was a Vodka and Cranberry juice in a Martini glass, which Tawarri was very obliging to provide.

I provided the Moet & Chandon for dinner only, so also decided to allow Hardy’s Champaign during the 30 minute pre-dinner drinks.

I initially prepaid $1000 on the tab, the tab ended up as $1400, with totals as;

  • 77x Johnny Walker Black
  • 8x Corona
  • 48x Gin and Tonic
  • 8x Hardy’s Champaign

The Gin and Tonic quantity also included any other drinks guests ordered. I was surprised in 30 minutes, 100 guests could consume 8 bottles of Champaign.

Sound System

Tawarri only provides a basic PA system (single microphone and single powered speaker), we used Matrix Productions to hire two self powered speakers which we connected to a mixer and wireless microphones.

Music

I decided to go with self mixing a pre-recorded ‘set’ and playing that on the night. Mixing software called MixMeister made it extremely easy.

Download the wedding music here (170mb).

Child meals

A baby under two years old was not charged and provided a high chair. A kids meal (under twelve years old) was available for $50 per child, teenagers where discounted to $70 per head, due to non-consumption of alcoholic beverages.

Venue Hire Extension

Tawarri allowed for the extension of the venue hire by one hour for $250 extra. This was a great deal, the issue with extending the hire (for all venues) was what to do with the beverages. Tawarri happily gave us many choices,

  • 1 hour venue extension only for an additional $250
  • 1 hour venue and standard beverage package extension for an additional $250 and $10 per person.
  • 1 hour venue, standard and bottled beverage package extension for an additional $250 and $25 per person.

We happily chose the venue extension only, unfortunately, due to licensing we couldn’t keep the bar open past 11pm.

Tables and Settings

Tawarri provided 10 person round tables, two 12 person round tables, a cake table and gift table. All linen was provided. They even offered to help with the table settings.

Champagne

Tawarri offers a number of options for Champagne,

  • $2.50 per person for toasting only, or
  • $2.50 per person for pre-dinner only, or
  • $6.00 per person through out the night

They surprised us and even allowed us to supply our pre-purchased Moet & Chandon for a minimal $5 corkage fee per bottle (which even included ice-buckets). We had two toasting sessions through out the night and Tawarri even refilled the glasses both times.

Pre-reception setup

As long as there is no other functions prior to yours during the day, Tawarri will allow for setup on the prior day. This was really a blessing, on the Friday prior we managed to setup the chair covers, cake, audio system and table settings in three hours.

Payment with cash

Tawarri offers a 2.5% discount if payment is made in cash, which was also a nice surprise.

Flowers

We decided to arrange the flower centrepieces ourselves, we sourced white Ranunculus from the florists in Mt Lawley, Perth. Bunches of approximately 10 stems were $6, we picked up 40 bunches for our 13 tables. Plain white vases were purchased from IKEA.

Cake

After a successful cake the previous year at our ceremony, we decided to again go with Perth’s Sugar and Spice Patisserie. And again we weren’t disappointed. We added Ranunculus onto the cake ourselves.

Bonbonnieres

After much thought, we found a lovely four-piece chocolate Bianca Boxes from Bateel. Mohammad Bagher Pashmi from the Bateel Dubai Mall was very helpful and professional placing the order via email. Unfortunately, discounts aren’t available for orders less than 5000 AED (approximately $1300 USD).

Food

The pre-dinner drinks appetiser was a let down, advertised as “Chef’s choice of cocktail items”, was only fried finger food.

Tawarri made available a vegetarian meal at no additional charge.

Tawarri offered a ‘chose two’ for the mains as part of the standard package. Orders were not taken throughout the night, but instead both dishes brought to the guests to chose. Whilst this isn’t dining etiquette, it didn’t make it easier for our non-English speaking relatives to chose.

Tea and Coffee

Tawarri’s advertised tea and coffee was a self-service table located outside the main room in the foyer.

thydzik Google Map v2.1 released – now with KML support

October 28th, 2011

The release of thydzik Goole Map version 2.1 supports KML files which once displayed can even be downloaded as GPX files.

Download from the WordPress plugin repository.

The following example uses the included example.kml file.

The following examples use the included example.xml file.

<markers>
<!-- Marker Z has no html to show nonclickability-->
<marker lat="-31.9554" lng="115.85859"  icon="Z" color="c89bff"/>
<marker lat="-32.053128" lng="115.745869" html="Fremantle"  icon="1" color="6b98ff"/>
<!-- Standard marker with html-->
<marker lat="-32.036036" lng="115.92724" html="<b>Lynwood</b><br>Residence of the author" color="ffed5c"/>
<marker lat="-31.963013" lng="115.836239" html="Kings Park" icon="KP" color="97ec7d"/>
<!-- Character marker with html that includes link-->
<marker lat="-31.956659" lng="115.869906" html="<a href="http://perthmint.com.au" rel="nofollow">Perth Mint</a>" icon="$" color="ffffff"/>
<!-- Example of two lines-->
<line colour="#0000FF" width="2" opacity="0.75">
	<point lat="-32.027579" lng="115.751266" />
	<point lat="-31.987404" lng="115.769463" />
	<point lat="-31.957697" lng="115.852203" />
	<point lat="-31.963814" lng="115.879326" />
	<point lat="-32.026415" lng="115.942154" />
</line>
<points colour="#FF0000" width="4" opacity="0.75">
	<point lat="-32.053128" lng="115.745869" />
	<point lat="-31.963013" lng="115.836239" />
	<point lat="-31.9554" lng="115.85859" />
	<point lat="-31.956659" lng="115.869906" />
	<point lat="-32.036036" lng="115.92724" />
</points>
</markers>
  • Marker Z – no HTML, nonclickable.
  • Marker 1 – standard maker with some text.
  • Marker Default – no icon defaults to standard Google Maps marker.
  • Marker $ – symbols can even be displayed on a marker and links in the HTML.
  • Marker KP – up to two characters can be displayed.

To display a map, simply type;

thydzikgooglemap(example.xml)

For the more adventurous;

thydzikgooglemap(example.xml, width, height, zoom, maptype)

where;

  • example.xml is your xml file, and example xml file is included with thdyzikGoogleMap in the plugin directory.
  • width is the optional width parameter, if left out the default width defined in the thydzikgooglemap options will be used.
  • height is the optional height parameter, if left out the default height defined in the thydzikgooglemap options will be used.
  • zoom is the optional zoom level from 0 to 17 (0 being the furthest away), if left out zoom will be calculated automatically to fit all points.
  • maptype is the optional map type parameters, which can be (Normal, G_NORMAL_MAP, N), (SATELLITE, G_SATELLITE_MAP, S), (HYBRID, G_HYBRID_MAP, H), (PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T) if left out Normal is defined.

Normal, G_NORMAL_MAP, N or left out; i.e. thydzikgooglemap(example.xml), thydzikgooglemap will produce a default styled map;

SATELLITE, G_SATELLITE_MAP, S; i.e. thydzikgooglemap(example.xml, 4, S), thydzikgooglemap will produce a satellite styled map. Note I have included a zoom of 4, and used the abreviation ‘S’;

HYBRID, G_HYBRID_MAP, H; i.e. tHyDzIkGoOgLeMaP(example.xml,hYbRiD,450,225), thydzikGoolgeMap will produce a hybrid styled map. Note I have included a width and height, and proved that capitalisation is not of concern;

PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T; i.e thydzikgooglemap(example.xml,TERRAIN), thydzikgooglemap will produce a terrain styled map;

Reading XML from different folder
The XML can be in any location, as long as the whole path is specified i.e. thydzikgooglemap(http://thydzik.com/geocaching/karratha-mar08/karratha-mar08.xml). Yes, even links in the marker text are preserved.

Reading XML from different domain
The XML can even be on a different domain, as long as the whole path is specified. i.e. thydzikgooglemap(http://sonyaandtravis.com/maps/our-nullarbor-adventure-clare-melbourne08.xml).

Related posts:

  1. thydzik Google Map v2.0 released – rewritten code supporting API v3 and gpx downloads!
  2. thydzikGoogleMap v1.5 – an inline Google map plugin for WordPress
  3. Ultimate Google Maps XML JavaScript function

Convert from Google KML to GPS Exchange Format GPX with PHP

October 27th, 2011

Here is a quick post on converting from KML files used in Google Earth/Maps to GPX Exchange Format (GPX) with PHP.

Code is quite explanatory, change $u with the location of the KML file, code will output GPX XML.

Alternatively, download the code here.

<?php
	//enter location of KML file here
	$u = "http://code.google.com/apis/kml/documentation/KML_Samples.kml";

	function utcdate() {
		return gmdate("Y-m-d\Th:i:s\Z");
	}

	$u_parts = pathinfo($u); //array of url parts
	$u_ext = strtoupper($u_parts['extension']);
	if ($u_ext== "KML") {

		$dom_kml = new DOMDocument();
		$dom_kml->load($u);

		$dom_gpx = new DOMDocument('1.0', 'UTF-8');
		$dom_gpx->formatOutput = true;

		//root node
		$gpx = $dom_gpx->createElement('gpx');
		$gpx = $dom_gpx->appendChild($gpx);

		$gpx_version = $dom_gpx->createAttribute('version');
		$gpx->appendChild($gpx_version);
		$gpx_version_text = $dom_gpx->createTextNode('1.0');
		$gpx_version->appendChild($gpx_version_text);

		$gpx_creator = $dom_gpx->createAttribute('creator');
		$gpx->appendChild($gpx_creator);
		$gpx_creator_text = $dom_gpx->createTextNode('http://thydzik.com');
		$gpx_creator->appendChild($gpx_creator_text);

		$gpx_xmlns_xsi = $dom_gpx->createAttribute('xmlns:xsi');
		$gpx->appendChild($gpx_xmlns_xsi);
		$gpx_xmlns_xsi_text = $dom_gpx->createTextNode('http://www.w3.org/2001/XMLSchema-instance');
		$gpx_xmlns_xsi->appendChild($gpx_xmlns_xsi_text);

		$gpx_xmlns = $dom_gpx->createAttribute('xmlns');
		$gpx->appendChild($gpx_xmlns);
		$gpx_xmlns_text = $dom_gpx->createTextNode('http://www.topografix.com/GPX/1/0');
		$gpx_xmlns->appendChild($gpx_xmlns_text);

		$gpx_xsi_schemaLocation = $dom_gpx->createAttribute('xsi:schemaLocation');
		$gpx->appendChild($gpx_xsi_schemaLocation);
		$gpx_xsi_schemaLocation_text = $dom_gpx->createTextNode('http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd');
		$gpx_xsi_schemaLocation->appendChild($gpx_xsi_schemaLocation_text);

		$gpx_url = $dom_gpx->createElement('url');
		$gpx_url = $gpx->appendChild($gpx_url);
		$gpx_url_text = $dom_gpx->createTextNode($u_parts['dirname']);
		$gpx_url->appendChild($gpx_url_text);

		$gpx_time = $dom_gpx->createElement('time');
		$gpx_time = $gpx->appendChild($gpx_time);
		$gpx_time_text = $dom_gpx->createTextNode(utcdate());
		$gpx_time->appendChild($gpx_time_text);

		// placemarks
		$names = array();
		foreach ($dom_kml->getElementsByTagName('Placemark') as $placemark) {
			//name
			foreach ($placemark->getElementsByTagName('name') as $name) {
				$name  = $name->nodeValue;
				//check if the key exists
				if (array_key_exists($name, $names)) {
					//increment the value
					++$names[$name];
					$name = $name." ({$names[$name]})";
				} else {
					$names[$name] = 0;
				}
			}
			//description
			foreach ($placemark->getElementsByTagName('description') as $description) {
				$description  = $description->nodeValue;
			}
			foreach ($placemark->getElementsByTagName('Point') as $point) {
				foreach ($point->getElementsByTagName('coordinates') as $coordinates) {
					//add the marker
					$coordinate = $coordinates->nodeValue;
					$coordinate = str_replace(" ", "", $coordinate);//trim white space
					$latlng = explode(",", $coordinate);

					if (($lat = $latlng[1]) && ($lng = $latlng[0])) {
						$gpx_wpt = $dom_gpx->createElement('wpt');
						$gpx_wpt = $gpx->appendChild($gpx_wpt);

						$gpx_wpt_lat = $dom_gpx->createAttribute('lat');
						$gpx_wpt->appendChild($gpx_wpt_lat);
						$gpx_wpt_lat_text = $dom_gpx->createTextNode($lat);
						$gpx_wpt_lat->appendChild($gpx_wpt_lat_text);

						$gpx_wpt_lon = $dom_gpx->createAttribute('lon');
						$gpx_wpt->appendChild($gpx_wpt_lon);
						$gpx_wpt_lon_text = $dom_gpx->createTextNode($lng);
						$gpx_wpt_lon->appendChild($gpx_wpt_lon_text);

						$gpx_time = $dom_gpx->createElement('time');
						$gpx_time = $gpx_wpt->appendChild($gpx_time);
						$gpx_time_text = $dom_gpx->createTextNode(utcdate());
						$gpx_time->appendChild($gpx_time_text);

						$gpx_name = $dom_gpx->createElement('name');
						$gpx_name = $gpx_wpt->appendChild($gpx_name);
						$gpx_name_text = $dom_gpx->createTextNode($name);
						$gpx_name->appendChild($gpx_name_text);

						$gpx_desc = $dom_gpx->createElement('desc');
						$gpx_desc = $gpx_wpt->appendChild($gpx_desc);
						$gpx_desc_text = $dom_gpx->createTextNode($description);
						$gpx_desc->appendChild($gpx_desc_text);

						//$gpx_url = $dom_gpx->createElement('url');
						//$gpx_url = $gpx_wpt->appendChild($gpx_url);
						//$gpx_url_text = $dom_gpx->createTextNode($ref);
						//$gpx_url->appendChild($gpx_url_text);

						$gpx_sym = $dom_gpx->createElement('sym');
						$gpx_sym = $gpx_wpt->appendChild($gpx_sym);
						$gpx_sym_text = $dom_gpx->createTextNode('Waypoint');
						$gpx_sym->appendChild($gpx_sym_text);
					}
				}
			}
			foreach ($placemark->getElementsByTagName('LineString') as $lineString) {
				foreach ($lineString->getElementsByTagName('coordinates') as $coordinates) {
					//add the new track
					$gpx_trk = $dom_gpx->createElement('trk');
					$gpx_trk = $gpx->appendChild($gpx_trk);

					$gpx_name = $dom_gpx->createElement('name');
					$gpx_name = $gpx_trk->appendChild($gpx_name);
					$gpx_name_text = $dom_gpx->createTextNode($name);
					$gpx_name->appendChild($gpx_name_text);

					$gpx_trkseg = $dom_gpx->createElement('trkseg');
					$gpx_trkseg = $gpx_trk->appendChild($gpx_trkseg);

					$coordinates = $coordinates->nodeValue;
					$coordinates = preg_split("/[\s\r\n]+/", $coordinates); //split the coords by new line
					foreach ($coordinates as $coordinate) {
						$latlng = explode(",", $coordinate);

						if (($lat = $latlng[1]) && ($lng = $latlng[0])) {
							$gpx_trkpt = $dom_gpx->createElement('trkpt');
							$gpx_trkpt = $gpx_trkseg->appendChild($gpx_trkpt);

							$gpx_trkpt_lat = $dom_gpx->createAttribute('lat');
							$gpx_trkpt->appendChild($gpx_trkpt_lat);
							$gpx_trkpt_lat_text = $dom_gpx->createTextNode($lat);
							$gpx_trkpt_lat->appendChild($gpx_trkpt_lat_text);

							$gpx_trkpt_lon = $dom_gpx->createAttribute('lon');
							$gpx_trkpt->appendChild($gpx_trkpt_lon);
							$gpx_trkpt_lon_text = $dom_gpx->createTextNode($lng);
							$gpx_trkpt_lon->appendChild($gpx_trkpt_lon_text);

							$gpx_time = $dom_gpx->createElement('time');
							$gpx_time = $gpx_trkpt->appendChild($gpx_time);
							$gpx_time_text = $dom_gpx->createTextNode(utcdate());
							$gpx_time->appendChild($gpx_time_text);
						}
					}
				}
			}
		}
		header("Content-Type: text/xml");
		echo $dom_gpx->saveXML();
	}
?>

Let me know if you find any issues.

Related posts:

  1. thydzik Google Map v2.0 released – rewritten code supporting API v3 and gpx downloads!
  2. Convert Relative Links to Absolute Links with PHP Regex
  3. VB6/VBA functions to convert binary string to Base64 string