Index: /extensions/rv_gmaps/trunk/admin/admin_edit.php
===================================================================
--- /extensions/rv_gmaps/trunk/admin/admin_edit.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/admin/admin_edit.php	(revision 13092)
@@ -116,5 +116,5 @@
 {
   $query='
-SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
+SELECT id,representative_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
   WHERE id IN ('.implode(',',$page['cat_elements_id']).')
   '.$conf['order_by'].'
@@ -130,6 +130,6 @@
 	$tpl_var = array_merge( $image,
       array(
-        'U_TN' => get_thumbnail_url($image),
-        'TITLE' => get_thumbnail_title($image)
+        'U_TN' => DerivativeImage::thumb_url($image),
+        'TITLE' => render_element_name($image)
       )
     );
Index: /extensions/rv_gmaps/trunk/admin/admin_sync.php
===================================================================
--- /extensions/rv_gmaps/trunk/admin/admin_sync.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/admin/admin_sync.php	(revision 13092)
@@ -5,5 +5,4 @@
   $sync_options = array(
     'simulate' => isset($_POST['simulate']),
-		'use_high' => isset($_POST['use_high']),
     'cat_id' => isset($_POST['cat_id']) ? (int)$_POST['cat_id'] : 0,
     'subcats_included' => isset($_POST['subcats_included']),
@@ -12,5 +11,4 @@
   $sync_options = array(
     'simulate' => true,
-		'use_high' => true,
     'cat_id' => 0,
     'subcats_included' => true,
@@ -35,5 +33,5 @@
 
     $query='
-SELECT id,path,lat,lon,has_high
+SELECT id,path,lat,lon
   FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
   WHERE category_id IN ('.implode(',', $cat_ids).')
@@ -43,5 +41,5 @@
   {
     $query='
-SELECT id,path,lat,lon,has_high
+SELECT id,path,lat,lon
   FROM '.IMAGES_TABLE;
   }
@@ -53,6 +51,4 @@
   {
 		$filename = $image['path'];
-		if ($sync_options['use_high'] and $image['has_high']=='true')
-			$filename = get_high_path($image);
 		$exif = @read_exif_data( $filename );
 		if ( empty($exif) )
@@ -110,5 +106,4 @@
     array(
       'SUBCATS_INCLUDED_CHECKED' => $sync_options['subcats_included'] ? 'checked="checked"' : '',
-			'USE_HIGH_CHECKED' => $sync_options['use_high'] ? 'checked="checked"' : ''
     )
   );
Index: /extensions/rv_gmaps/trunk/admin/admin_sync.tpl
===================================================================
--- /extensions/rv_gmaps/trunk/admin/admin_sync.tpl	(revision 13091)
+++ /extensions/rv_gmaps/trunk/admin/admin_sync.tpl	(revision 13092)
@@ -27,5 +27,4 @@
     <ul>
       <li><label><input type="checkbox" name="simulate" value="1" checked="checked" /> {'only perform a simulation (no change in database will be made)'|@translate}</label></li>
-			<li><label><input type="checkbox" name="use_high" value="1" {$USE_HIGH_CHECKED} /> use high resolution images if available</label></li>
     </ul>
   </fieldset>
Index: /extensions/rv_gmaps/trunk/changelog.txt
===================================================================
--- /extensions/rv_gmaps/trunk/changelog.txt	(revision 13091)
+++ /extensions/rv_gmaps/trunk/changelog.txt	(revision 13092)
@@ -1,2 +1,5 @@
+2.4.a
+-compatible with piwigo 2.4
+
 2.3.b
 - search for places / location uses now google auto complete
Index: /extensions/rv_gmaps/trunk/include/functions.php
===================================================================
--- /extensions/rv_gmaps/trunk/include/functions.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/include/functions.php	(revision 13092)
@@ -4,6 +4,5 @@
 {
 	global $conf;
-	$dir = $conf['local_data_dir'];
-	return $dir.'/tmp/_rvgm_cat_cache.dat';
+	return PHPWG_ROOT_PATH.$conf['data_location'].'/tmp/_rvgm_cat_cache.dat';
 }
 
Index: /extensions/rv_gmaps/trunk/include/functions_map.php
===================================================================
--- /extensions/rv_gmaps/trunk/include/functions_map.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/include/functions_map.php	(revision 13092)
@@ -10,5 +10,5 @@
   global $page, $conf;
   unset( $page['__rvm_config__'] );
-  return $conf['local_data_dir'].'/plugins/'.basename(dirname(dirname(__FILE__))).'.dat';
+  return PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(dirname(__FILE__))).'.dat';
 }
 
Index: /extensions/rv_gmaps/trunk/include/picture_map.inc.php
===================================================================
--- /extensions/rv_gmaps/trunk/include/picture_map.inc.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/include/picture_map.inc.php	(revision 13092)
@@ -9,5 +9,4 @@
   array(
     'RVM_PLUGIN_VERSION' => RVM_PLUGIN_VERSION,
-    'GMAPS_API_KEY' => $conf['gmaps_api_key'],
     'PLUGIN_ROOT_URL' => get_absolute_root_url().'plugins/'.$rvm_dir,
 		'PLUGIN_LOCATION' => 'plugins/'.$rvm_dir,
@@ -35,5 +34,4 @@
   $template->assign(
     array(
-      'TN_SRC' => $picture['thumbnail'],
       'U_NO_MAP' => duplicate_picture_url(),
       'U_BLOWUP' => rvm_make_blowup_url( array('ll'=>$picture), array('start','box') ),
Index: /extensions/rv_gmaps/trunk/kml.php
===================================================================
--- /extensions/rv_gmaps/trunk/kml.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/kml.php	(revision 13092)
@@ -44,5 +44,5 @@
 
 
-$img_fields = ' i.id,i.tn_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon,i.date_creation';
+$img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon,i.date_creation';
 
 rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_ARRAY, $order_by);
@@ -92,10 +92,10 @@
   {
     $query = '
-SELECT id, path, tn_ext
+SELECT id, path, representative_ext
   FROM '.IMAGES_TABLE.'
   WHERE id IN ('.implode(',', $thumbnail_ids).')';
     $result = pwg_query($query);
     while ($row = mysql_fetch_assoc($result))
-      $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);
+      $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row);
     unset($thumbnail_ids);
   }
@@ -149,14 +149,9 @@
 	$page_url = duplicate_picture_url(array('image_id' => $img['id'],'image_file' => $img['file']),  array('start') );
 
-	if (!empty( $img['name'] ) )
-		$title = $img['name'];
-	else
-		$title = str_replace('_', ' ', get_filename_wo_extension($img['file']));
-
   $tpl_var = array(
       'U_PAGE'=> $page_url,
       'TN_SRC'  => get_thumbnail_url($img),
-      'TITLE'  => $title,
-      'DESCRIPTION'  => trigger_event('render_element_description', $img['comment']),
+      'TITLE'  => render_element_name($img),
+      'DESCRIPTION'  => render_element_description($img),
       'LAT'   => $img['lat'],
       'LON'   => $img['lon'],
Index: /extensions/rv_gmaps/trunk/main.inc.php
===================================================================
--- /extensions/rv_gmaps/trunk/main.inc.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/main.inc.php	(revision 13092)
@@ -1,5 +1,5 @@
 <?php /*
 Plugin Name: RV Maps&Earth
-Version: 2.3.b
+Version: 2.4.a
 Description: Extend your gallery with Google Maps and Google Earth ...
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=122
@@ -7,5 +7,5 @@
 Author URI: http://www.modusoptimus.com/
 */
-define( 'RVM_PLUGIN_VERSION', '2.3.b');
+define( 'RVM_PLUGIN_VERSION', '2.4.a');
 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
 
Index: /extensions/rv_gmaps/trunk/maintain.inc.php
===================================================================
--- /extensions/rv_gmaps/trunk/maintain.inc.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/maintain.inc.php	(revision 13092)
@@ -39,5 +39,5 @@
 	{
 	  global $conf;
-		$dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
+		$dest = PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
 	  if (!file_exists($dest) )
 	  {
@@ -70,5 +70,5 @@
   
   global $conf;
-	$dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
+	$dest = PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
   @unlink( $dest );
 }
Index: /extensions/rv_gmaps/trunk/map_data.php
===================================================================
--- /extensions/rv_gmaps/trunk/map_data.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/map_data.php	(revision 13092)
@@ -31,5 +31,5 @@
 $where_sql = rvm_bounds_to_sql( $page['box'] );
 
-$img_fields = ' i.id,i.tn_ext,i.name,i.comment,i.path,i.lat,i.lon';
+$img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.path,i.lat,i.lon';
 
 $was_flat = @$page['flat'];
@@ -42,4 +42,5 @@
 header('Pragma:');*/
 header('Content-Type: text/plain; charset='.get_pwg_charset());
+header('X-Robots-Tag: noindex');
 
 if ( extension_loaded('zlib') && !ini_get('zlib.output_compression') )
Index: /extensions/rv_gmaps/trunk/mapl.php
===================================================================
--- /extensions/rv_gmaps/trunk/mapl.php	(revision 13091)
+++ /extensions/rv_gmaps/trunk/mapl.php	(revision 13092)
@@ -49,9 +49,10 @@
   $where_sql = rvm_bounds_to_sql( $page['box'] );
 
-$img_fields = ' i.id,i.tn_ext,i.name,i.path,i.lat,i.lon';
+$img_fields = ' i.id';
 
 $was_flat = @$page['flat'];
 $page['flat']=true;
 rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_HASH, $order_by);
+$page['items']=array_keys($page['items']);
 if (!$was_flat) unset($page['flat']);
 
@@ -61,5 +62,5 @@
 {
 /* GENERATE THE CATEGORY LIST *************************************************/
-$where_sql = 'i.id IN ('.implode(',', array_keys($page['items']) ).')';
+$where_sql = 'i.id IN ('.implode(',', $page['items'] ).')';
 $where_sql .= get_sql_condition_FandF(
         array( 'forbidden_categories' => 'category_id' ),
@@ -95,5 +96,5 @@
 
 /* GENERATE THE TAG LIST ******************************************************/
-$tags = get_common_tags( array_keys($page['items']), $conf['content_tag_cloud_items_number'], null);
+$tags = get_common_tags( $page['items'], $conf['content_tag_cloud_items_number'], null);
 $tags = add_level_to_tags($tags);
 function counter_compare($a, $b)
@@ -145,8 +146,26 @@
   );
 
-foreach ($page['items'] as $img)
-{
-  $img['file'] = basename( $img['path'] );
-  $thumbnail_url = get_thumbnail_url($img);
+$pictures = array();
+if (count($page['items']) > 0)
+{
+  $rank_of = array_flip($page['items']);
+
+  $query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $page['items']).')
+;';
+  $result = pwg_query($query);
+  while ($row = pwg_db_fetch_assoc($result))
+  {
+    $row['rank'] = $rank_of[ $row['id'] ];
+    $pictures[] = $row;
+  }
+  usort($pictures, 'rank_compare');
+  unset($rank_of);
+}
+
+foreach ($pictures as $img)
+{
   $page_url = duplicate_picture_url(
         array(
@@ -157,19 +176,23 @@
         array('start')
       );
-  if (!empty( $img['name'] ) )
-    $title = $img['name'];
-  else
-    $title = str_replace('_', ' ', get_filename_wo_extension($img['file']));
-
-  $template->append(
-    'thumbnails',
-    array(
-      'TN_SRC'       => $thumbnail_url,
-      'URL'  => $page_url,
-      'TN_ALT'   => $img['file'],
-      'TN_TITLE'   => $title,
-      )
-    );
-}
+  $name = render_element_name($img);
+  $desc = render_element_description($img);
+
+  $tpl_thumbnails_var[] = array_merge( $img, array(
+		'NAME' => $name,
+    'TN_ALT' => htmlspecialchars(strip_tags($name)),
+    'TN_TITLE' => get_thumbnail_title($img, $name, $desc),
+    'URL' => $page_url,
+    'DESCRIPTION' => $desc,
+    'src_image' => new SrcImage($img),
+    ) );
+}
+$template->assign( array(
+  'derivative_params' => ImageStdParams::get_by_type(IMG_THUMB),
+  'SHOW_THUMBNAIL_CAPTION' => false,
+	'thumbnails' => $tpl_thumbnails_var,
+    ) );
+$template->set_filename('index_thumbnails', 'thumbnails.tpl');
+$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
 
 $title = $page['title'];
Index: /extensions/rv_gmaps/trunk/template/mapl.tpl
===================================================================
--- /extensions/rv_gmaps/trunk/template/mapl.tpl	(revision 13091)
+++ /extensions/rv_gmaps/trunk/template/mapl.tpl	(revision 13092)
@@ -1,4 +1,3 @@
-{html_head}
-<style type="text/css">
+{html_style}
 .fullTagCloud {ldelim}
 	text-align: justify;
@@ -9,6 +8,5 @@
 	display: inline;white-space: nowrap;
 }
-</style>
-{/html_head}
+{/html_style}
 
 <div id="content" class="content" style="margin: 0;">
@@ -50,18 +48,12 @@
 {/if}
 
-{if !empty($navbar) }{include file='navigation_bar.tpl'}{/if}
+{if !empty($navbar)}{include file='navigation_bar.tpl' assign='NAVBAR'}{$NAVBAR}{/if}
 
-{if not empty($thumbnails)}
-<ul class="thumbnails">
-	{foreach from=$thumbnails item=thumbnail}
-	<li><span class="wrap1"><span class="wrap2">
-			<a href="{$thumbnail.URL}" title="{$thumbnail.TN_TITLE}">
-				<img class="thumbnail" src="{$thumbnail.TN_SRC}" alt="{$thumbnail.TN_ALT}" />
-			</a>
-			</span></span>
-	</li>
-	{/foreach}
+{if !empty($THUMBNAILS)}
+<ul class="thumbnails" id="thumbnails">
+{$THUMBNAILS}
 </ul>
 {/if}
 
+{if !empty($NAVBAR)}{$NAVBAR}{/if}
 </div>
Index: /extensions/rv_gmaps/trunk/template/picture_map_content.tpl
===================================================================
--- /extensions/rv_gmaps/trunk/template/picture_map_content.tpl	(revision 13091)
+++ /extensions/rv_gmaps/trunk/template/picture_map_content.tpl	(revision 13092)
@@ -1,3 +1,2 @@
-
 {html_head}
 <script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language={$lang_info.code}" type="text/javascript"></script>
@@ -5,6 +4,5 @@
 {combine_script id='jquery.nyroModal' load='async' path="`$PLUGIN_LOCATION`/template/nyroModal/jquery.nyroModal-1.6.2.js" version='1.6.2'}
 <link href="{$PLUGIN_ROOT_URL}/template/nyroModal/nyroModal.css" rel="stylesheet" type="text/css">
-
-<style type="text/css">{literal}
+{/html_head}{html_style}{literal}
 #mapPicture {
 	position:absolute;
@@ -20,10 +18,9 @@
 }
 
-#thumbPrev, #thumbNext {display:none;}
-{/literal}</style>
-{/html_head}
+#linkPrev, #linkNext {display:none}
+{/literal}{/html_style}
 
 <div id="mapPicture">
-<a href="{$U_NO_MAP}" title="{'return to normal view mode'|@translate}" rel="nofollow"><img src="{$TN_SRC}" alt="thumb"/></a>
+<a href="{$U_NO_MAP}" title="{'return to normal view mode'|@translate}" rel="nofollow"><img src="{$current.THUMB_SRC}" alt="thumb"/></a>
 <br/>
 <a href="{$U_BLOWUP}" onclick="return blowupUrl(this.href);">{'More photos near this location'|@translate}</a>
