How to handle GPX files with JCE

Here you'll find detailed instructions on how to create your gpxtracks root folder, and how to handle the uploading of GPX files to your server with JCE (JoomlaContentEditor).

There's also a handy tweak how you can upload your GPX files "into" your article while editing it with JCE - no FTP or other stuff required(!).

 

 

Note: due to a recently discovered vulnerability, it is strongly recommended to upgrade JCE to at least version 2.3.1! The latest version of JCE can be downloaded here.

Your JCE is up-to-date? OK then, let's start!

 

1. Creating the GPX root folder "gpxtracks"

From the Control panel, open the JCE file browser:

gtm-jce-file-browser

You will likely land in your /images folder which is shown as "Root" in the JCE file browser (which is one of the many reasons why i put my GPX files under /images ). If you land somewhere else, navigate to the /images folder.

Now create a folder named "gpxtracks" using the "New folder" button in the upper right corner, like so:

gtm-jce-filebrowser-new-folder-button

gtm-jce-new-folder

After that, you should see something like this:

gtm-jce-filebrowser-make-gpx-folder

 

2. Configuring the JCE file browser to allow GPX file upload

By default, JCE will not let you upload files with a .gpx extension. You will get an error message "unknown file type" or similar.

To let JCE allow you to upload .gpx files. do the following:

Go to Components / JCE Editor / Profiles:

gtm-jce-profiles

Click on the name of the profile you're using (here: "Default"). Now you have to navigate to the place where you can select the allowed extensions, which is a bit hard to find if you don't know it:

gtm-jce-enable-gpx-upload

Go to the uppermost tab "Plugin parameters", then on the left side open tab "File Browser". In the row "Permitted file extensions" click the edit button on the right. Add a new group "GPS", then, in the box below that, enter "gpx".

Save & Close those settings. OK, now we're ready to upload our GPX files with JCE!

 

3. Uploading GPX files with the JCE file browser

Open up the JCE file browser from the control panel. Click on the "gpxtracks" folder in the left column, or double-click it in the middle column.

Then click the "Upload" button (next to the "New Folder" button).

gtm-jce-drop-files

Now you can either drag'n'drop your GPX files from the Explorer onto the "Drop files here" box, or hit the "Browse" button and use the standard "Open File" box to navigate to your files and select them for upload.

All GPX's in the drop box? OK, then hit "Upload". You'll see a progress window like this:

gtm-jce-upload-gpx

Ready! Now you can close the JCE file browser, and go to Content / Articles to edit your article to include the GPX tracks on a map.

4. Configuring the JCE image(!) browser to enable GPX file upload

Hum, that's a bit clumsy - upload a GPX file from the Control Panel / JCE file browser, then go to the article editor and type in the GPX filename again...

Well, there is an even easier way. You can upload your GPX file "into" your article, WHILE writing the article, with the JCE Image browser.

Here's the trick: we "fool" the JCE image browser ( which is available in the normal JCE article editing toolbar ) into believing that a GPX file is an image. To do this, we have to go back to the JCE profiles, under Content / JCE Editor / Profiles:

gtm-jce-allow-gpx-image-upload

We again go the the uppermost "Plugin parameters" tab, but now to the "Image manager" tab on the left. Again, theres a row "Permitted file extensions" - again, clĂ­ck the edit button and "Add new type" - gpx. Save & Close the profile.

Note: doing this "trick" with GPX files is harmless - they are just XML data files with coordinates and timestamps. You should NOT use this dirty trick with any other file types - this could result in a severe security risk!

5. Upload a GPX file "into" an article while editing the article

All right - you have written your description of your trip, and now you are at the place where the GPX track map should appear.

gtm-jce-image-manager-button

Click the Image Manager button, as if you would like to put an image into your article.

With the "tweaked" setting done above, JCE will now show the GPX files also in the Image Manager. You can now also use the "Upload" button to upload your GPX file. After you have uploaded it, close the Upload popup and click on the file name once in the center column, like below:

gtm-jce-enable-gpx-in-image-manager

Now select the file name (and only that!) with the mouse, and copy it into the clipboard. 

Since you don't really want to insert an image into the text, just click "Cancel". All we wanted is to upload the track file from within the editor, and have its filename in the clipboard.

All that's left to do now is to write the invocation code for GPXTrackMap:

{gpxtrackmap}{/gpxtrackmap},

then place the cursor between the center curly braces and paste the filename from the clipboard into there. Save your article - done! That's about as easy as it can get i think...

P.S.: Of course i had to test this - while writing this article - so: here's the track: ;-)

 

27.5 km, 8 days 17 hrs 18 mins