Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Affichage d'un histogramme  (Read 6908 times)

0 Members and 1 Guest are viewing this topic.

pixelmaniac

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Affichage d'un histogramme
« on: June 08, 2008, 07:39:17 pm »

Bonjour à tous.

J'aimerais afficher l'histogramme (ou graphique) de l'exposition ou de la balance des couleurs dans ma galerie dans la description des images (dans la partie exif plus précisément), j'avais fais une petite modification sur ma précédente galerie qui me générait un hist_nomdelaphoto.png qui marchait au poil mais depuis que j'ai tout effacé, impossible de remettre la main sur ce plugin ou un hack identique...

help me !
« Last Edit: June 09, 2008, 05:51:55 pm by Pascal YAP »
Logged

François Keller

  • Moderator
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 9094
  • aka Frantz
    • Ma galerie
Re: Affichage d'un hitogramme
« Reply #1 on: June 08, 2008, 08:11:24 pm »

euh! jamais entendu parler de ce genre de plugin. C'était avec une galerie coppermine ?
Logged
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Pascal YAP

  • Moderator
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 13833
  • Hello World :-)
    • CPG 1.5.x ExperiMental website
Re: Affichage d'un histogramme
« Reply #2 on: June 09, 2008, 05:27:25 pm »

Vous cherchez ceci ?  ;D
(https://forum.coppermine-gallery.net/index.php?action=dlattach;topic=18759.0;attach=1430;image)



1/ Ouvrez DISPLAYIMAGE.PHP et trouvez la fonction html_picinfo()

Code: [Select]
// WORK ONLY WITH GD 2.0, absolutly not with IMAGEMAGIK
// Update by PYAP 09 June 08 A.Sparrius
// Création Affichage Histogramme
    if (function_exists('ImageTypes')) {  // Only do if GD exists, not IMAGEMAGIC
      if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){
        $condition = true;
      }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
        $condition = true;
      }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
        $condition = true;
      }else{
       $condition = false;
      }
      if ($CONFIG['make_intermediate'] && $condition ) {
          $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
      } else {
          $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
      }
      if (strtoupper(substr($picture_url,strlen($picture_url)-3,3))=="JPG") {
        $info[$lang_picinfo['Histogram']]="<img src='histogramme.php?image=".$picture_url."'>";
      }
    }
// End Addition
    return theme_html_picinfo($info);
}


2/ Créez un nouveau fichier nommé histogramme.php et placez-le à la racine de votre Coppermine :

Code: [Select]
<?php
// Histogramme cr&#233;ation A.Sparrius 6/9/05 Updated by PYAP 09 June 08
// Free to use and change, provided you keep these lines :)
        
$tmp_image $_REQUEST['image'];
        
$image_array=split('[/\]',$tmp_image);
        
$image=$image_array[count($image_array)-1];
        
$path=rtrim($tmp_image,$image);
        
$hist_file="hist_".substr($image,0,strlen($image)-4).".png";
    if (
file_exists($path.$hist_file)) {
        
$im=imagecreatefromPNG($path $hist_file);
        
imagePNG($im);
        
imagedestroy($im);
        } else {
               
$im=imagecreatefromjpeg($path.$image);
               for(
$i=0;$i<imagesx($im);$i+=2)
       {
               for(
$j=0;$j<imagesy($im);$j++)
       {
       
$rrggbb=imagecolorsforindex ($imimagecolorat($im,$i,$j));
       
$r[$rrggbb['red']]+=1;
       
$g[$rrggbb['green']]+=1;
       
$b[$rrggbb['blue']]+=1;
        }
         }
               for (
$i=0;$i<256;$i++)
       {
       
$max[$i]=($r[$i]+$g[$i]+$b[$i])/3;
         }
       
$max_value=max($max)/150;
       
$m[0]=max($r);
       
$m[1]=max($b);
       
$m[2]=max($g);
       
$max_rgb=max($m)/150;
       
$im_out imageCreate (284164);
       
$background imageColorAllocate($im_out,100,100,100);
       
$box_fill   imageColorAllocate($im_out,70,70,70);
       
$white=ImageColorAllocate($im_out,200,200,200);
       
$black=ImageColorAllocate($im_out,20,20,20);
       
$grey=ImageColorAllocate($im_out,160,160,160);
       
$red=ImageColorAllocate($im_out,255,0,0);
       
$green=ImageColorAllocate($im_out,0,200,0);
       
$blue=ImageColorAllocate($im_out,0,0,255);
       
$ry=107;
       
$gy=107;
       
$by=107;

       
imageFilledRectangle($im_out,13,6,270,158,$box_fill);
       for(
$i=0;$i<256;$i++)
       {
        
imageLine($im_out$i+14157$i+14157-($max[$i]/$max_value),$white);
        
imageLine($im_out$i+13$ry$i+14157-($r[$i]/$max_rgb), $red);
        
imageLine($im_out$i+13$gy$i+14157-($g[$i]/$max_rgb), $green);
        
imageLine($im_out$i+13$by$i+14157-($b[$i]/$max_rgb), $blue);
       
$ry=157-($r[$i]/$max_rgb);
       
$gy=157-($g[$i]/$max_rgb);
       
$by=157-($b[$i]/$max_rgb);
       }
        
imageSetThickness($im_out,3);
        
imageLine($im_out,13,158,272,158,$grey);
        
imageLine($im_out,13,6,272,6,$black);
        
imageLine($im_out,13,6,13,158,$black);
        
imageLine($im_out,272,6,272,158,$grey);
        
imagePNG($im_out,$path $hist_file);
        
imageDestroy($im);
        
imagedestroy($im_out);
       
$im=imagecreatefromPNG($path $hist_file);
        
imagePNG($im);
        
imagedestroy($im);
       }
?>

3/ Ouvrez votre (ou vos) fichier de Langue, french.php en l'occurence,
    Cherchez  "$lang_picinfo = array("
et ajoutez la ligne suivante :
Code: [Select]
        'Histogram'=>'Histogramme',
« Last Edit: June 09, 2008, 05:56:56 pm by Pascal YAP »
Logged

pixelmaniac

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Affichage d'un histogramme
« Reply #3 on: June 09, 2008, 09:58:47 pm »

Pascal YAP... je vous aime :)
Logged

Pascal YAP

  • Moderator
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 13833
  • Hello World :-)
    • CPG 1.5.x ExperiMental website
Re: Affichage d'un histogramme
« Reply #4 on: June 10, 2008, 12:42:20 am »

Quote
Pascal YAP... je vous aime
Faut pas !!!!!! ça me gène !  ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.