Index: extensions/Histogram/admin.php
===================================================================
--- extensions/Histogram/admin.php	(revision 15346)
+++ extensions/Histogram/admin.php	(revision 15346)
@@ -0,0 +1,35 @@
+<?php
+/* -----------------------------------------------------------------------------
+  Plugin     : Histogram
+  Author     : Grum
+    email    : grum@piwigo.org
+    website  : http://photos.grum.fr
+
+    << May the Little SpaceFrog be with you ! >>
+  ------------------------------------------------------------------------------
+  See main.inc.php for release information
+
+  --------------------------------------------------------------------------- */
+
+if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
+
+global $prefixeTable, $template;
+load_language('plugin.lang', HGRAM_PATH);
+
+$main_plugin_object = get_plugin_data($plugin_id);
+
+
+if(CommonPlugin::checkGPCRelease(3,2,0))
+{
+  $config=Array();
+  GPCCore::loadConfig('hgram', $config);
+
+  include(HGRAM_PATH."hgram_aip.class.inc.php");
+  $plugin_ai = new HGram_AIP($prefixeTable, $main_plugin_object->getFileLocation());
+}
+
+$plugin_ai->manage();
+
+
+
+?>
Index: extensions/Histogram/admin/plugin_admin.php
===================================================================
--- extensions/Histogram/admin/plugin_admin.php	(revision 15345)
+++ 	(revision )
@@ -1,35 +1,0 @@
-<?php
-/* -----------------------------------------------------------------------------
-  Plugin     : Histogram
-  Author     : Grum
-    email    : grum@piwigo.org
-    website  : http://photos.grum.fr
-
-    << May the Little SpaceFrog be with you ! >>
-  ------------------------------------------------------------------------------
-  See main.inc.php for release information
-
-  --------------------------------------------------------------------------- */
-
-if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
-
-global $prefixeTable, $template;
-load_language('plugin.lang', HGRAM_PATH);
-
-$main_plugin_object = get_plugin_data($plugin_id);
-
-
-if(CommonPlugin::checkGPCRelease(3,2,0))
-{
-  $config=Array();
-  GPCCore::loadConfig('hgram', $config);
-
-  include(HGRAM_PATH."hgram_aip.class.inc.php");
-  $plugin_ai = new HGram_AIP($prefixeTable, $main_plugin_object->getFileLocation());
-}
-
-$plugin_ai->manage();
-
-
-
-?>
Index: extensions/Histogram/hgram_aip.class.inc.php
===================================================================
--- extensions/Histogram/hgram_aip.class.inc.php	(revision 15345)
+++ extensions/Histogram/hgram_aip.class.inc.php	(revision 15346)
@@ -39,5 +39,5 @@
     $this->tabsheet->add('config',
                           l10n('hgram_config'),
-                          $this->getAdminLink()."&amp;f_tabsheet=config");
+                          $this->getAdminLink()."-config");
   }
 
@@ -54,5 +54,5 @@
   {
     parent::initEvents();
-    if($_REQUEST['f_tabsheet']=='search')
+    if($_GET['tab']=='search')
     {
       // load request builder JS only on the search page
@@ -72,5 +72,5 @@
     $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/hgram_admin.tpl");
 
-    switch($_REQUEST['f_tabsheet'])
+    switch($_GET['tab'])
     {
       case 'config':
@@ -79,5 +79,5 @@
     }
 
-    $this->tabsheet->select($_REQUEST['f_tabsheet']);
+    $this->tabsheet->select($_GET['tab']);
     $this->tabsheet->assign();
     $selected_tab=$this->tabsheet->get_selected();
@@ -97,7 +97,7 @@
   protected function checkRequest()
   {
-    if(!isset($_REQUEST['f_tabsheet'])) $_REQUEST['f_tabsheet']='config';
+    if(!isset($_GET['tab'])) $_GET['tab']='config';
 
-    if(!($_REQUEST['f_tabsheet']=='config')) $_REQUEST['f_tabsheet']='config';
+    if(!($_GET['tab']=='config')) $_GET['tab']='config';
   }
 
Index: extensions/Histogram/hgram_histogram.class.inc.php
===================================================================
--- extensions/Histogram/hgram_histogram.class.inc.php	(revision 15345)
+++ extensions/Histogram/hgram_histogram.class.inc.php	(revision 15346)
@@ -18,4 +18,5 @@
 if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+define('MAX_PIXELS_ANALYZED', 1000000);
 
 
@@ -92,11 +93,23 @@
         $imageHeight=imagesy($image);
 
+
+        $ratio=1;
+        $nbPixels=$imageWidth*$imageHeight;
+        if($nbPixels>MAX_PIXELS_ANALYZED) $ratio=$nbPixels/MAX_PIXELS_ANALYZED;
+
+        $imageWorkWidth=round($imageWidth/$ratio,0);
+        $imageWorkHeight=round($imageHeight/$ratio,0);
+        $imageWork=imagecreatetruecolor($imageWorkWidth,$imageWorkHeight);
+        imagecopyresampled($imageWork, $image, 0, 0, 0, 0, $imageWorkWidth, $imageWorkHeight, $imageWidth, $imageHeight);
+        //imagecopyresized($imageWork, $image, 0, 0, 0, 0, $imageWorkWidth, $imageWorkHeight, $imageWidth, $imageHeight);
+        imagedestroy($image);
+
         $i=0;
-        for($px=0;$px<$imageWidth;$px++)
-        {
-          for($py=0;$py<$imageHeight;$py++)
+        for($px=0;$px<$imageWorkWidth;$px++)
+        {
+          for($py=0;$py<$imageWorkHeight;$py++)
           {
             $i++;
-            $value=imagecolorat($image, $px, $py);
+            $value=imagecolorat($imageWork, $px, $py);
 
             $rgb=self::IntToRGB($value);
@@ -116,8 +129,8 @@
         }
 
-        imagedestroy($image);
+        imagedestroy($imageWork);
 
         self::$fileHistogram=Array(
-          'pixels'   => $imageWidth*$imageHeight,
+          'pixels'   => $imageWorkWidth*$imageWorkHeight,
           'analyzed' => $i,
           'time'     => microtime(true)-$time,
Index: extensions/Histogram/hgram_version.inc.php
===================================================================
--- extensions/Histogram/hgram_version.inc.php	(revision 15345)
+++ extensions/Histogram/hgram_version.inc.php	(revision 15346)
@@ -15,6 +15,6 @@
   if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-  define('HGRAM_VERSION',  '0.1.1');
-  define('HGRAM_VERSION2', '00.01.01');
+  define('HGRAM_VERSION',  '0.2.0');
+  define('HGRAM_VERSION2', '00.02.00');
   define('HGRAM_GPC_NEEDED', '3.5.2');
 ?>
Index: extensions/Histogram/js/histoLoad.min.js
===================================================================
--- extensions/Histogram/js/histoLoad.min.js	(revision 15345)
+++ 	(revision )
@@ -1,2 +1,0 @@
-/* file: histLoad.js - v1.0.0 | minified on 2011/09/25 with http://jscompress.com/ */
-function HistoLoad(){var a=function(a,b){$.ajax({type:"POST",url:"plugins/Histogram/hgram_ajax.php",async:true,data:{ajaxfct:"public.histo.build",id:a,token:b},success:function(a){if(a!=""){$("#iHistoTxt").remove();$("#iHistoContent").append('<img id="#iHistoImg" src="local/plugins/Histogram/'+a+'">')}}})};this.get=function(b,c){a(b,c)}}
Index: extensions/Histogram/main.inc.php
===================================================================
--- extensions/Histogram/main.inc.php	(revision 15345)
+++ extensions/Histogram/main.inc.php	(revision 15346)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Histogram
-Version: 0.1.1
+Version: 0.2.0
 Description: Allow to make stat on pictures colors
 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=393
@@ -27,4 +27,6 @@
 |         |            |   . compatibility with Piwigo 2.2
 |         |            |
+| 0.2.0   | 2011/09/25 | * mantis feature:2640
+|         |            |   . compatibility with Piwigo 2.4
 |         |            |
 |         |            |
Index: extensions/Histogram/templates/hgram_picture_histo.tpl
===================================================================
--- extensions/Histogram/templates/hgram_picture_histo.tpl	(revision 15345)
+++ extensions/Histogram/templates/hgram_picture_histo.tpl	(revision 15346)
@@ -1,8 +1,8 @@
-{combine_script id="jquery" path="themes/default/js/jquery.min.js"}
+{combine_script id="jquery" path="themes/default/js/jquery.js"}
 
 
 <div id='iHistoContent' style='text-align:center;'>
 {if $histoImg==''}
-  {combine_script id="histogram.histoLoad" path="plugins/Histogram/js/histoLoad.min.js" require="jquery"}
+  {combine_script id="histogram.histoLoad" path="plugins/Histogram/js/histoLoad.js" require="jquery"}
   <span id='iHistoTxt'>{'hgram_loading_histo'|@translate}</span>
   <script type='text/javascript'>
