Show Geotagging from images within a category

Phoca Gallery - image gallery extension
bjoernp
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 May 2011, 15:05

Show Geotagging from images within a category

Post by bjoernp »

Hi,
I would like to show the geotaggs for all images within a category in the map. Is this possible? If not, where should I change the code to make it possible?
Regards, Bjoern
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49149
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Show Geotagging from images within a category

Post by Jan »

Hi, no, there is no such option, you need to load all the markers for all listed images on the site, try to see:

components/com_phocagallery/views/category/view.html.php
components/com_phocagallery/views/category/tmpl/ ... .php

and its controllers and models

Jan
If you find Phoca extensions useful, please support the project
bjoernp
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 May 2011, 15:05

Re: Show Geotagging from images within a category

Post by bjoernp »

Hey Jan,
thanks a lot for the hints. My hack is working quite well and it wasn't that difficult. So thanks for that.

I have now another question and maybe you can give me again such a great hint.
I would like to enable the users to set the geotag infos already with the upload. For that I will only use the simple uploader and now I need to know where to get the code for selecting the geotag-infos and where the code has to be placed.

Can you help on that, too?
Many thanks Bjoern
pflieger
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 15 Mar 2010, 08:53

Re: Show Geotagging from images within a category

Post by pflieger »

Hallo Björn!

I would like to have the same function in my site. Is it possible to share your resolution?
I am not a good programmer, but I am very interested. :-)

Many greetings und thank you in advance :twisted:

Thomas
(German)
bjoernp
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 May 2011, 15:05

Re: Show Geotagging from images within a category

Post by bjoernp »

Of course I'm going to post the modifications here...
Currently I'm working on some further enhancements (like customizing in the backend). Once this is final, y.u can get it.

Best, Bjoern

P.S.
What about:
I have now another question and maybe you can give me again such a great hint.
I would like to enable the users to set the geotag infos already with the upload. For that I will only use the simple uploader and now I need to know where to get the code for selecting the geotag-infos and where the code has to be placed.
pflieger
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 15 Mar 2010, 08:53

Re: Show Geotagging from images within a category

Post by pflieger »

Hey Bjoern,

thank you for the positive and quick reply und I will wait for your code enhancement. :wink:
I think many other web developer are lucky to have that function. :twisted:

@Jan: Is there a chance to include this in the Phoca Gallery Core?

Many greetings and thanks in advance

Thomas
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49149
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Show Geotagging from images within a category

Post by Jan »

Added to feature request list.

Jan
If you find Phoca extensions useful, please support the project
bjoernp
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 23 May 2011, 15:05

Re: Show Geotagging from images within a category

Post by bjoernp »

Here is the first part:
You can set in in the backend weather you would like to see the geotag for the category and/or the pictures within.

Adjust DB
ALTER TABLE `jos_phocagallery_categories` ADD `showcategoryinmap` TINYINT( 1 ) DEFAULT '0' NOT NULL , ADD `showimagesinmap` TINYINT( 1 ) DEFAULT '0' NOT NULL ;

administrator/components/com_phocagallery/models/forms/phocagallerxcxml
Line 34:

Code: Select all

<field name="showcategoryinmap" type="Text" class="inputbox" size="40" label="COM_PHOCAGALLERY_SHOW_CATEGORY_IN_MAP_LABEL" description="COM_PHOCAGALLERY_FIELD_SHOW_CATEGORY_IN_MAP_DESC"  />
<field name="showimagesinmap" type="Text" class="inputbox" size="40" label="COM_PHOCAGALLERY_SHOW_IMAGES_IN_MAP_LABEL" description="COM_PHOCAGALLERY_FIELD_SHOW_IMAGES_IN_MAP__DESC"  />

administrator/components/com_phocagallery/views/phocagalleryc/tmpl/edit.php
Line 48

Code: Select all

'latitude', 'longitude', 'zoom', 'geotitle', 'showcategoryinmap', 'showimagesinmap');
administrator/language/en-GB/en-GB.com_phocagallery.ini
Line 12

Code: Select all

;[BP changes]
COM_PHOCAGALLERY_SHOW_CATEGORY_IN_MAP_LABEL="Show category in Map"
COM_PHOCAGALLERY_FIELD_SHOW_CATEGORY_IN_MAP_DESC="Set 1 if you would like to see the category pin in the category map."
COM_PHOCAGALLERY_SHOW_IMAGES_IN_MAP_LABEL="Show images in Map"
COM_PHOCAGALLERY_FIELD_SHOW_IMAGES_IN_MAP__DESC="Set 1 if you would like to see the immages pins in the category map."
components/com_phocagallery/views/category/tmpl/default_geotagging.php
replace Line 39

Code: Select all

	//---BP---start---
	// Markers for Images
	$totalImg = count($this->mapImg);
	$iC=0;
	if($this->map['showimagesinmap'] == 1){
		for($iM = 0; $iM < $totalImg; $iM++) {
			echo $map->setMarker($iM,$this->mapImg[$iM]['geotitle'],$this->mapImg[$iM]['description'],$this->mapImg[$iM]['latitude'], $this->mapImg[$iM]['longitude'], $iconOutput['icon'] );
			$iC =$iM;
		}
	}
	$iC++;
	if($this->map['showcategoryinmap'] == 1){
		echo $map->setMarker($iC,$this->map['geotitle'],$this->map['description'],$this->map['latitude'], $this->map['longitude'], $iconOutput['icon'] );
	}
	//---BP---end---

components/com_phocagallery/views/category/view.html.php
Line 666

Code: Select all

//$this->tmpl['displayicongeo'] = 0;
Line 669

Code: Select all

		//----BP---start---
		// 1. GEOTAGGING IMMAGES
		if($category->showimagesinmap==1){
			$imagesGeo	= $model->getData(0);
			$totalImg = count($imagesGeo);
			for($iM = 0; $iM < $totalImg; $iM++) {
			
				$mapImg[$iM]['longitude']	= $imagesGeo[$iM]->longitude;
				$mapImg[$iM]['latitude']	= $imagesGeo[$iM]->latitude;
				$mapImg[$iM]['zoom']		= $imagesGeo[$iM]->zoom;
				$mapImg[$iM]['geotitle'] 	= $imagesGeo[$iM]->geotitle;
				$mapImg[$iM]['description'] = $imagesGeo[$iM]->description;
				if ($mapImg[$iM]['geotitle'] == '') {
					$mapImg[$iM]['geotitle']	= $imagesGeo[$iM]->title;
				}	

			}
		}
		if($category->showimagesinmap==0 &&  $category->showcategoryinmap==0){
			$this->tmpl['displayicongeo'] = 0;
		}
		$map['showimagesinmap'] = $category->showimagesinmap;
		$map['showcategoryinmap'] = $category->showcategoryinmap;
		if(($category->showimagesinmap == 1) || ($category->showcategoryinmap == 1)){
			$this->tmpl['displayicongeo'] = 1;	
		}else{
			$this->tmpl['displayicongeo'] = 0;			
		}
		//---BP---end---
Hope it works for you, too. Now I will try to add the setting of geotags for images already at upload.
Bjoern
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49149
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Show Geotagging from images within a category

Post by Jan »

Hi, thank you for this guide.

Jan
If you find Phoca extensions useful, please support the project
pflieger
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 15 Mar 2010, 08:53

Re: Show Geotagging from images within a category

Post by pflieger »

Wow Bjoern,

thank you very much for this huge work!! :twisted:

Ich will try to implement your code.

Many Greetings

Thomas
Post Reply