zenphoto forums » Plugins

Google map on search page

(4 posts)
  1. cloepfe

    Apprentice
    Joined: Jun '12
    Posts: 3

    Hello
    First of all: Thanks a lot for your great photo gallery. I was looking and comparing for quite a while and zenphoto really rocks.

    I got a small problem though: I want to include the printGoogleMap function on the search page, so that it displays a map containing all the search results (at least the ones that contain GPS data). Is this possible at all? In the plugin documentation you state that it automatically detects if it is on an image or an album page. Does this mean that there is no possibility to include it on the search.php page?

    Posted 1 year ago #
  2. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,818

    There is actually a parameter you can pass to the printGoogleMap() function to identify the album/image you want mapped. As well there is a call-back function to allow you to collect a group of points to be mapped.

    I believe that calling printGoogleMap(NULL, NULL, NULL, 'album_page', 'map_callback'); on the searh page and providing the map_callback() function to populate the geodata from the images found by the search will work, but it is not tried. For examples of this callback, see the effervescence+ and garland themes album handling.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  3. cloepfe

    Apprentice
    Joined: Jun '12
    Posts: 3

    Thanks man! It works like a charm. I just included the map_callback function as used in the effervescence+ album page and then called the printGoogleMap(NULL, NULL, NULL, 'album_page', 'map_callback'); as supposed by you.

    You really rock!

    Posted 1 year ago #
  4. cloepfe

    Apprentice
    Joined: Jun '12
    Posts: 3

    Hi sbillard
    I encountered another problem. I can populate the geodata from the images and display the map with markers. This works perfectly on my search site now (e.g. http://www.strukturlos.ch/zenphoto/page/search/biene).
    However, if I click on one of the markers, the info bubble content is empty. On the normal album page it displays the image name in the bubble. I tried to stick to the effervescence+ album page to see how the image name is collected there, but I really can't find a solution how to collect the data and pass it to the printGoogleMap() function.
    Maybe you have a solution?

    Here the code for my image-<div> on the search page:

    <?php if (getNumImages() > 0) { ?>
    			<div id="images">
    				<?php
    				while (next_image()) {
    
    				if ($map) {
    			 		$coord = getGeoCoord($_zp_current_image);
    			 		if ($coord) {
    			 			$coord['desc'] = '<p align=center>'.$coord['desc'].'</p>';
    			 			$points[] = $coord;
    			 		}
    		 		}
    				?>
    				<div class="image">
    					<div class="imagethumb"><a>" title="<?php echo getBareImageTitle();?>"><?php printImageThumb(getBareImageTitle()); ?></a></div>
    				</div>
    				<?php } ?>
    			</div>
     		<br clear="all" />
    <?php } ?>

    And after that I use the map_callback as follows:

    `<?php
    if (!empty($points) && map) {
    function map_callback($map) {
    global $points;
    foreach ($points as $coord) {
    addGeoCoord($map, $coord);
    }
    }
    ?>

    <div id="map_link">
    <?php printGoogleMap(NULL, NULL, NULL, 'album_page', 'map_callback'); ?>
    </div>
    <?php
    }
    ?>`

    Posted 12 months ago #

RSS feed for this topic

Reply

You must log in to post.