• [MOD] Histogram 4 0 5 1
Currently:  

Author Topic: [MOD] Histogram  (Read 221857 times)

0 Members and 1 Guest are viewing this topic.

Offline udo w.

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Histogram
« Reply #75 on: September 23, 2006, 12:53:27 PM »
Hallolo.. :D

Also irgendwie funktionierts und irgendwie funktionierts auch wieder nicht....
Bei manchen Bildern wird ein "Histogramm" angelegt - bei anderen habe ich immer noch das weiße Blatt...
Das Histogramm das angezeigt wird sieht so aus:

http://www.entscheidende-augenblicke.de/details.php?image_id=86

oder so:

http://www.entscheidende-augenblicke.de/details.php?image_id=19 

Hier der Code der Histo.php

Code: [Select]
<?php
//      Histogram creation
//      Created by Anton Sparrius (Spaz) 6/9/05  anton_spaz@yahoo.com
//      Free to use and change, provided you keep these lines :)


if (isset($HTTP_GET_VARS['hist_image']) || isset($HTTP_POST_VARS['hist_image'])) {
  $hist_image = (isset($HTTP_GET_VARS['hist_image'])) ? stripslashes(trim($HTTP_GET_VARS['hist_image'])) : stripslashes(trim($HTTP_POST_VARS['hist_image']));
}
else {
  $hist_image "";
}

if (isset(
$HTTP_GET_VARS['hist_path']) || isset($HTTP_POST_VARS['hist_path'])) {
  $hist_path = (isset($HTTP_GET_VARS['hist_path'])) ? stripslashes(trim($HTTP_GET_VARS['hist_path'])) : stripslashes(trim($HTTP_POST_VARS['hist_path']));
}
else {
  $hist_path "";
}

if (isset(
$HTTP_GET_VARS['hist_file']) || isset($HTTP_POST_VARS['hist_file'])) {
  $hist_file = (isset($HTTP_GET_VARS['hist_file'])) ? stripslashes(trim($HTTP_GET_VARS['hist_file'])) : stripslashes(trim($HTTP_POST_VARS['hist_file']));
}
else {
  $hist_file "";
}

//                        $hist_image = $_REQUEST['image'];
//                        $hist_path = $_REQUEST['filepath'];
//                        $hist_path = "albums/".$hist_path;
                        


                        
if (file_exists($hist_path.$hist_file)) {
                          $im=imagecreatefromPNG($hist_path $hist_file);
                          imagePNG($im);
                          imagedestroy($im);
                        } else {
                        $im=imagecreatefromjpeg($hist_path.$hist_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 (280164);
                        $background imageColorAllocate($im_out,70,70,70);
                        $hist=ImageColorAllocate($im_out,0,0,0);
                        $white=ImageColorAllocate($im_out,143,143,134);
                        $red=ImageColorAllocate($im_out,255,0,0);
                        $green=ImageColorAllocate($im_out,0,255,0);
                        $blue=ImageColorAllocate($im_out,0,0,255);
                        $ry=107;
                        $gy=107;
                        $by=107;

                        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);
                        }
                        imageLine($im_out,13,158,270,158,$hist);
                        imageLine($im_out,13,6,270,6,$hist);
                        imageLine($im_out,13,6,13,158,$hist);
                        imageLine($im_out,270,6,270,158,$hist);

                        imagePNG($im_out,$hist_path $hist_file);
                        imageDestroy($im);
                        imagedestroy($im_out);
                        $im=imagecreatefromPNG($hist_path $hist_file);
                        imagePNG($im);
                        imagedestroy($im);
                        }
?>



...hier der Code der detais.php

Code: [Select]
<?php
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------

//--- Start Histogramm 27.02.2006 ----------------------
$hist_image $image_row['image_media_file'] ;
$hist_file"hist_".substr($hist_image,0,strlen($hist_image)-4).".png";
$hist_path "data/histo/";

$ext substr($hist_imagestrpos($hist_image".")+1strlen($hist_image));
$AutorisedImageType = array ("jpg""jpeg""JPG""JPEG");  // Dateitypen für die das Histogramm gezeigt werden soll

if (in_array($ext$AutorisedImageType)) {
   $histogramm_image "<img src='histo.php?hist_image=".$hist_image."&hist_file=".$hist_file."&hist_path=".$hist_path."' border=\"1\">";
} else {
   $histogramm_image REPLACE_EMPTY;
}

$site_template->register_vars(array(
   "histogramm" => "Histogramm:",
   "histogramm_image" => $histogramm_image
));
//--- Ende Histogramm 27.02.2006 ------------------------

?>


...und hier der Code der details.html

Code: [Select]
<?php
{if histogramm_image}                 
<tr>
<td valign="top" class="row1"><b>{histogramm}</b></td>
<td valign="top" class="row1">{histogramm_image}</td>
</tr>
{endif 
histogramm_image}
?>


Anmerkung: Die PHP-Markierung habe ich nur zur besseren farblichen Kennzeichnung hinzugefügt.

Vielleicht hat ja noch jemand ne Idee...  :)

Grüßle
Udo

Offline pantograf

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [req mod] histogram
« Reply #76 on: October 31, 2006, 03:53:07 PM »
Replace
Code: [Select]
$im_out = imageCreate (280, 164);with:
Code: [Select]
$im_out = imageCreateFromPNG ("background.png");then upload your background.png image into same directory where histo.php is.
P.S. make sure the image is 280x164

das funktioniert leider falsch (oder ich habe was falsch gemacht). Das Histogramm liegt nicht genau auf dem background Bild.
« Last Edit: November 01, 2006, 12:36:02 AM by pantograf »

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] Histogram
« Reply #77 on: November 09, 2006, 09:40:34 AM »
i get this error


Warning: imagepng(): Unable to open 'data/media/27/hist_ugly-chimp_copy_copy.png' for writing in /home2/lamers/public_html/histo.php on line 61

Warning: imagecreatefrompng(data/media/27/hist_ugly-chimp_copy_copy.png): failed to open stream: No such file or directory in /home2/lamers/public_html/histo.php on line 64

Warning: imagepng(): supplied argument is not a valid Image resource in /home2/lamers/public_html/histo.php on line 65

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home2/lamers/public_html/histo.php on line 66t this error


Offline Phil87

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Design des Histogramms
« Reply #78 on: November 21, 2006, 06:36:44 PM »
Hallo!
Ich habe versucht das Histogramm so zu bauen, wie es bei Ivan und mawenzi in der Galerie zu finden ist, sieht wesentlich besser aus, als die Version mit dem grauen Hintergrund... hat auch soweit geklappt, d. h. habe in der details.html ne Tabelle mit Hintergrund erzeugt, in der das Histogramm mit entsprechendem Hintergrund angezeigt wird, allerdings habe ich noch einige kleine Designfehler, bei denen ich nicht weiß wie ich sie beheben soll, vllt. könnt ihr mir ja helfen:

1. Wie bekommen ich diese hellblaue Umrandung weg?
2. Wie kann ich die Farbe des Gesamtgraphs von weiß auf grau ändern, wie bei euch?
3. Bei manchen Bildern wird bei mir überhaupt kein Histogramm angezeigt und bei anderen ein total Konfuses, woran kann das liegen? Nur in seltenen Fällen werden mir Graphen angezeigt die in etwa richtig sind.
4. Wie kann ich das Histogramm genau platzieren? Ich weiß zwar schon welche Zahlen dafür zuständig sind, aber ich kann daraus keine Schlussfolgerung ziehen, soll heißen ich verstehe das System dahinter nicht ganz.

Würd mich freuen wenn ihr mir helfen könnt!

Gruß
Phil

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Histogram
« Reply #79 on: November 21, 2006, 07:01:56 PM »
0. ein Link um sich dein Histogramm mal anzusehen und festzustellen was zu verbessern ist, wäre natürlich hilfreich ...
1. sämtliche Farbeinstellungen nimmt man in der histo.php bzw. histogramm.php vor ... RGB-Farbwerte einfach ändern ...
2. wie 1. ...
3. siehe 0. um das bewerten zu können ...
4. platzieren ... wo ? Zahlenwerte ... welche ? ...

Eine ausführliche Einbauanleitung incl. FAQ nach der auch die von dir genannten User ihr Histogramm für ihre Bilder erstellen lassen findest du hier !
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Phil87

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: [MOD] Histogram
« Reply #80 on: November 21, 2006, 07:28:20 PM »
Danke!
Durch dein Forum haben sich alle meine Fragen erledigt!

Gruß
Phil

Offline desperate_housewif

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Histogram
« Reply #81 on: February 22, 2007, 02:24:30 PM »
Wie kann man es machen, dass lediglich eine Zeile mit dem Link "Histogramm" in der detail. html eingebaut wird, und man bei Bedarf daraufklicken kann, und sich dann das Histogramm an gleicher Stelle öffnet?
Wäre auch interessant für die Exif-Datein usw., damit die Detailseite zunächst übersichtlich bleibt und die Informationen nur bei Bedarf aufgerufen werden können.

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [MOD] Histogram
« Reply #82 on: February 22, 2007, 02:33:32 PM »
so wie auf www.sascha-droemer.de ???

Offline desperate_housewif

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Histogram
« Reply #83 on: February 22, 2007, 04:57:29 PM »
Ja, genauso. Auch für Histogramm und für Kommentare!!!

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [MOD] Histogram
« Reply #84 on: February 22, 2007, 05:51:00 PM »
meinste das kannste nicht "klauen"? *g*

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Histogram
« Reply #85 on: February 22, 2007, 05:55:46 PM »
... einfach ein Java-Toggle-Script verwenden ...
... so etwa wie hier für IPTC- und EXIF-Info ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline desperate_housewif

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Histogram
« Reply #86 on: March 11, 2007, 10:21:44 AM »
Alles funktioniert soweit, nur das Histogramm selbst begeistert mich nicht von aussehen. Offensichtlich ist "histoback.gif" dafür zuständig, finde ich aber nicht in meinem Verzeichnis.
Wie kann ich das Standardhistoramm durch ein eigenes tauschen?

Offline Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [MOD] Histogram
« Reply #87 on: April 11, 2007, 02:36:57 AM »
mawenzi,
could you place here your final variant with imageID and without many arguments?

All,
about
Code: [Select]
$hist_path = "data/histo/";There is a bug, because you need to change the histo.php accordingly.

I use the following solution:

1. Create subfolders (with 777 attributes) like in the data/media/:

data/histo/1
data/histo/2
....
data/histo/n (where n - is the last category).

2. Change details.php like this:

Code: [Select]
//--- Start Histogramm 27.02.2006 ----------------------
$hist_image = $image_row['image_media_file'] ;
$hist_file= "hist_".substr($hist_image,0,strlen($hist_image)-4).".png";
$hist_path = "data/media/".$cat_id."/";
$histout_path = "data/histo/".$cat_id."/";

$ext = substr($hist_image, strpos($hist_image, ".")+1, strlen($hist_image));
$AutorisedImageType = array ("jpg", "jpeg", "JPG", "JPEG");

if (in_array($ext, $AutorisedImageType)) {
   $histogramm_image = "<img src='histo.php?hist_image=".$hist_image."&hist_file=".$hist_file."&histout_path=".$histout_path."&hist_path=".$hist_path."' border=\"1\">";
} else {
   $histogramm_image = REPLACE_EMPTY;
}

$site_template->register_vars(array(
   "histogramm" => "Гистограмма:",
   "histogramm_image" => $histogramm_image
));
//--- Ende Histogramm 27.02.2006 ------------------------

There we added a new variable - $histout_path.

3. Replace all in the histo.php

$path.$hist_file
to
$histout_path.$hist_file

It's all.
Digital Photo Gallery: http://gallery.imagemaster.ru

Offline desperate_housewif

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Histogram
« Reply #88 on: April 11, 2007, 07:49:29 PM »
Ich bin ja nicht wählerisch mit meinem Histogramm, aber ich will wenigstens den dunkleren Hintergrund in z.B. weiss ändern. Ich habe verstanden, dass man die RGB Werte in der Histo.php ändern muss. Ich habe jetzt fast alle Zahlen geändert. Ich sehe keinen Unterschied im Histogramm. Welche Zahlen muss ich denn jetzt ändern?

Offline Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [MOD] Histogram
« Reply #89 on: April 11, 2007, 08:07:46 PM »
desperate_housewif,
did you removed the old histogram images from /data/meida? Also you need clear the cache in your browser.
Digital Photo Gallery: http://gallery.imagemaster.ru