4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: om6acw on February 23, 2006, 07:54:23 AM

Title: [MOD] Histogram
Post by: om6acw on February 23, 2006, 07:54:23 AM
It is possible to make something like this http://coppermine-gallery.net/forum/index.php?topic=18759.0 for 4image gallery ?
Title: Re: [req mod] histogram
Post by: V@no on February 23, 2006, 08:06:48 AM
I didnt get what does it represent and what is it for? what use of it?
Title: Re: [req mod] histogram
Post by: trez on February 23, 2006, 08:11:17 AM
http://www.luminous-landscape.com/tutorials/understanding-series/understanding-histograms.shtml
Title: Re: [req mod] histogram
Post by: om6acw on February 23, 2006, 08:24:50 AM
I didnt get what does it represent and what is it for? what use of it?

That script is to make a graph created from picture and show if it is overexposed or underexposed, that mod is used freqently by photographers.
Title: Re: [req mod] histogram
Post by: ch€ri{Bi}² on February 23, 2006, 11:32:42 AM
that mod is used freqently by photographers.

 :?: so the first question should be : is there a php script (or a class or any other script) which is able to do a picture histogram (like a digital camera  :wink: ) ?  so if the answer is no, surely it  means that it  should not be easy to do it. but who knows?

well, i think it's possible with GD or imagemagick but for the moment, all the questions i found on the net about this have no answer....
...for the moment...  :roll:
Title: Re: [req mod] histogram
Post by: trez on February 23, 2006, 11:55:54 AM
there is a file:

http://www.phpclasses.org/browse/file/4643.html

The problem would be to integrate it into 4images. Thats where v@no or any other good coder can help, if he want to.
Title: Re: [req mod] histogram
Post by: Vincent on February 23, 2006, 02:12:12 PM
hmmm - why do you need this - just because it could be possible!

a fotografer have to controll his picture at home, where he could do some corection, and not on a Server in the web.

sincerly
vincent
Title: Re: [req mod] histogram
Post by: V@no on February 23, 2006, 02:49:55 PM
a fotografer have to controll his picture at home, where he could do some corection, and not on a Server in the web.
But...that mod is for server...for the home people are using photoshop ;)
Title: Re: [req mod] histogram
Post by: Vincent on February 23, 2006, 03:39:11 PM
@V@no
so it is more a fun function - because you can't change a uploadet picture on the server!  :?
vincent
Title: Re: [req mod] histogram
Post by: om6acw on February 24, 2006, 05:58:45 AM
hmmm - why do you need this - just because it could be possible!

a fotografer have to controll his picture at home, where he could do some corection, and not on a Server in the web.

sincerly
vincent

I dont need that for corection of pictures on server, I need to show histogram because I want to show to customer that picture is corectly exposed. There is no way to see how a picture is exposed without histogram.
Title: Re: [req mod] histogram
Post by: om6acw on February 24, 2006, 06:04:48 AM
that mod is used freqently by photographers.

 :?: so the first question should be : is there a php script (or a class or any other script) which is able to do a picture histogram (like a digital camera  :wink: ) ?  so if the answer is no, surely it  means that it  should not be easy to do it. but who knows?

well, i think it's possible with GD or imagemagick but for the moment, all the questions i found on the net about this have no answer....
...for the moment...  :roll:

php script is here :

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 :)
//
                        
$image $_REQUEST['image'];
                        
$filepath $_REQUEST['filepath'];
                        
$path "albums/".$filepath;

                        
$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 (280164);
                        
$background imageColorAllocate($im_out,70,70,70);
                        
$hist=ImageColorAllocate($im_out,171,205,239);
                        
$white=ImageColorAllocate($im_out,255,255,255);
                        
$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,$path $hist_file);
                        
imageDestroy($im);
                        
imagedestroy($im_out);
                        
$im=imagecreatefromPNG($path $hist_file);
                        
imagePNG($im);
                        
imagedestroy($im);
                        }
?>


but I dont now how I can put this to 4image

On coppermine gallery looks like this (see attachment)
Title: Re: [req mod] histogram
Post by: mawenzi on February 27, 2006, 09:07:21 PM
Histogramm in 4images :

Die Diskusion ist sicher berechtigt, in wie weit die Präsentation des Histogramms zu einem Bild auf der Website sinnvoll ist. Wer dieses Tool also auf seiner Website einsetzen möchte, sollte sich das vorher klar machen. Ich denke aber in einer "Fotografen-Galerie" kann man davon zur Bildbeurteilung durchaus Gebrauch machen, zumal die User die sich auf so einer Website tummeln sicher auch etwas damit anfangen können. Auf der anderen Seite kann man sich heute bereits in den Digicams das Histogramm zum frisch geschossenen Bild anzeigen lassen.

Ich habe das Histogramm für 4images mal mit folgendem Ergebnis umgesetzt :

Zu sehen und zu testen hier : Test Histogramm in 4images (http://klick.kl.funpic.de/details.php?image_id=20)

In dem von mir modifizierten details.php-Code für das Histogramm können die Dateitypen festgelegt werden, für die das Histogramm angezeigt werden soll, da nur eine beschränkte Dateien-Auswahl dafür in Betracht kommt. Sinnvoll sind hier sicher nur Dateien mit der Extensionen ... *.jpg und *.jpeg ! Doch die Auswahl steht dir zur Konfiguration offen.

Für die Umsetzung wäre nun folgendes zu erledigen.


[edit_10.02.2010]

Habe die hier ursprünglich veröffentlichte Version entfernt, da diese noch nicht ausgereift war. Obwohl das hier vermerkt war, wurde trotzdem immer wieder versucht diese Version zu installieren, obwohl ich hier bereits auf eine ausgereifte Version zum Download hingewiesen hatte. Da ich nicht immer wieder darauf in diesem Thread hinweisen will und mir anhören muss ... funktioniert nicht ... habe ich diese Vorversion entfernt.

[/edit_10.02.2010]


P.S. zur Arbeitsweise dieser Modifikation :
- mit Aufruf der Detailseite wird nach dem Check des Dateityps über die histo.php das Histogramm als Bilddatei erzeugt
- dieser Vorgang kann u.U. etwas Zeit in Anschruch nehmen bis das Histogramm auf der Detailseite angezeigt wird
- diese Histogramm-Datei hist_dateiname.png wird dann im gleichen Ordner wie das Original-Bild gespeichert
- bei wiederholtem Aufruf der Detailseite wird nun das bereits vorhandene Histogramm als Bild geladen
- dieser Vorgang verläuft dann natürlich schneller


@all
... I redesigned this MOD with some fixes ...
... you can download all neccesary files and the installations instruction ... Download - MOD Histogram (http://klick.kl.funpic.de/files.php?id=29) ...

@alle
... ich habe den MOD neu gestaltet mit einigen Fixes ...
... du kannst alle notwendigen Dateien und die Installationsanweisung downloaden ... Download - MOD Histogramm (http://klick.kl.funpic.de/files.php?id=29) ...

Beispiel / Example :
Hier ein mit dem aktuellen MOD generiertes Histogramm von dem Bild, welches auch über den oben aufgeführten Test-Link zu sehen ist ...

(http://klick.kl.funpic.de/bilder/histogram_sample.png)
Title: Re: [req mod] histogram
Post by: ch€ri{Bi}² on February 27, 2006, 11:00:15 PM
@mawenzi : It seems very good...
:?: Is there a chance to get it in english ?  :wink:
Thanks!
Title: Re: [req mod] histogram
Post by: Loda on February 27, 2006, 11:11:31 PM
wow! thank you very much for this!
Title: Re: [req mod] histogram
Post by: om6acw on February 27, 2006, 11:25:58 PM
thanks a lot mawenzi :!: :!: :!:
Title: Re: [req mod] histogram
Post by: IcEcReaM on February 28, 2006, 12:53:40 AM
hey mawenzi,
wouldn't it be better if you post it then in an seperate mod thread?
Title: Re: [req mod] histogram
Post by: mawenzi on February 28, 2006, 01:23:01 AM
@ cheribibi,
an English translation is coming soon ... :wink:

@Loda,
warst ja wieder schneller als die Polizei erlaubt, danke für das Testen ... :mrgreen:

@om6acw,
tried my best ... found your inquiry very interesting ... :D

@ IcEcReaM,
nach dem Vorgeplänkel habe ich nicht gedacht, dass ein allgemeines Interesse besteht bzw. sich entwickeln könnte. Hast natürlich Recht ...  :wink: . Werde mit der englischen Übersetzung die Sache als MOD posten ...  :!:

mawenzi
Title: Re: [req mod] histogram
Post by: IcEcReaM on February 28, 2006, 01:34:40 AM
@ IcEcReaM,
nach dem Vorgeplänkel habe ich nicht gedacht, dass ein allgemeines Interesse besteht bzw. sich entwickeln könnte. Hast natürlich Recht ...  :wink: . Werde mit der englischen Übersetzung die Sache als MOD posten ...  :!:

mawenzi

naja unterschätze mal die User nicht, die bauen sich alles ein, was sie bekommen können..^^
Aber mal ernst, ist denke ich immer besser, sowas als Mod zu posten,
da es dann bei der Suche nacher einfach ist,
wenn man gleich erkennen kann, dass es sich bei dem Thread um einen Mod handelt.
Title: Re: [req mod] histogram
Post by: Loda on February 28, 2006, 08:52:34 AM
hallo!
i want to change the background for the histogramm. i want to insert an image as background for it. how can i do this?
Title: Re: [req mod] histogram
Post by: V@no on February 28, 2006, 09:01:01 AM
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
Title: Re: [req mod] histogram
Post by: Loda on February 28, 2006, 11:12:10 PM
jepp... thank you!
Title: Re: [req mod] histogram
Post by: V@no on March 01, 2006, 12:52:45 AM
And how accurate this histogram is? can someone compare it with some software that also has histogram?
Title: Re: [req mod] histogram
Post by: om6acw on March 01, 2006, 08:43:45 AM
And how accurate this histogram is? can someone compare it with some software that also has histogram?


For me looks exactly same :
http://www.myanimalsworld.com/sk/details.php?image_id=147

Title: Re: [req mod] histogram
Post by: Loda on March 02, 2006, 05:21:23 PM
And how accurate this histogram is? can someone compare it with some software that also has histogram?
exactly the same! i think...
1. screenshoot of an imageprogram
2. scrennshoot of the histogram in 4images
Title: Re: [req mod] histogram
Post by: V@no on March 03, 2006, 01:44:52 AM
Great!
There are some ways to improve this:
1) instead of sending the image path to histo.php, send only the image id and let histo.php get all needed info about where the image is. This also will help people who is using the code from "pic security" topic that hides real path of the images.
2) caching the historgram images. As far as I understood the code of histo.php, it scans every single pixel in the image and it is quiet havy for a server. So saving the result into a file and then showing the saved image would improve the perfomance, but will take up more space on the server...

[EDIT]
never mind my 2) note...its already present... :oops:
Title: Re: [req mod] histogram
Post by: mawenzi on March 03, 2006, 02:35:13 AM
Great!

... it works (http://klick.kl.funpic.de/details.php?image_id=3092) really great ... !

... This also will help people who is using the code from "pic security" topic that hides real path of the images.

... but where is the real path shown ... ?
... hist_path is also needed for hist_file (histo.png) ... ! ... or you stores the histo.png's in a new / extra folder ...
... like always ... there are several ways / solutions ...


[EDIT]
never mind my 2) note...its already present... :oops:

...  :mrgreen:  ...
Title: Re: [req mod] histogram
Post by: V@no on March 03, 2006, 02:42:56 AM
... but where is the real path shown ... ?
... hist_path is also needed for hist_file (histo.png) ... ! ... or you stores the histo.png's in a new / extra folder ...
... like always ... there are several ways / solutions ...

this path:[qcode]histogramm.php?hist_image=kilimanjaro_axxxxi_2.jpg&hist_path=data/media/XX/&hist_file=02_hist_kilimanjaro_axxxxi_2.png[/qcode](filename and path altered in this example)
Title: Re: [req mod] histogram
Post by: mawenzi on March 03, 2006, 04:53:41 AM
V@no ... you are right ... like always ... :!:

I've changed the code in details.php and histogramm.php ... and now is only send the hist_image_id to histogramm.php ... that's  saver .
It works (http://klick.kl.funpic.de/details.php?image_id=3092) really greater ... !

and no path is shown ...
Code: [Select]
histogramm.php?hist_image_id=xxxx

thanks for the reference ...
Title: Re: [req mod] histogram
Post by: ch€ri{Bi}² on March 03, 2006, 11:33:56 AM
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

well i guess all the code is based on this size... so all graphics are drawn referring to this size...
... and how can i change the size of the output history picture (with graphics..)?
 
Title: Re: [req mod] histogram
Post by: mawenzi on March 03, 2006, 10:05:01 PM
... and how can i change the size of the output history picture (with graphics..)?

... you can change width and height for 'imageCreate' ...
... but then you must adapt also the coordinates in all 'imageLine' to your new width and height ...
... but the inner coordinates for width=255 should not be changed i.m.o. ...
... it is the graph from left (darkest) to right (brightest) ("RGB-Farbraum" ... 8 Bits ... 0 - 255 ... 28=256 ) ...
... you can change through test ...

But I found some other little problems.
... by saving the hist_xxx.png in the cat-folders you find all these images in APC -> Check new images ...  :?
... but when we save all the hist_'image_media_file'.png in a new folder e.g. /data/media/histo ... there can be also problems ...
... there is the possibility, that 2 pictures from different folders have the same file name ...
... and than is hist_'image_media_file'.png = hist_media_file.png  in the same folder ...
... it sould be better we create the names of the histo.png with image_ids like hist_'image_id'.png ...
... and save the hist_'image_id'.png in /data/media/histo ...

I will try that in such a way ... or there are other suggestions ...  :roll:

mawenzi
Title: Re: [req mod] histogram
Post by: V@no on March 04, 2006, 12:45:02 AM
@mawenzi:
Try save all the files into one independent folder and name each file with image id.
For example if an image has ID 12568 the saved chache histogram image would have name 12568.png
I think that is the easiest way to do and no need to wory about creating additional folders for each category, etc ;)
Title: Re: [req mod] histogram
Post by: mawenzi on March 04, 2006, 02:47:16 PM
so, after all small problems are solved (or there are still others ... ?) could now a MOD from it are made ...  :D
Title: Re: [req mod] histogram
Post by: Loda on March 04, 2006, 04:05:28 PM
yipeee... I'm waiting...  :D
Title: Re: [req mod] histogram
Post by: dosensteck on March 05, 2006, 10:11:13 PM
thanks a lot mawenzi :!: :!: :!:

kann mich nur anschliessen!

and a thx for vano (background)

http://hobby-fotografen.com/img1908.htm
Title: Re: [req mod] histogram
Post by: mawenzi on March 07, 2006, 07:57:17 PM
@ V@no,

... and once again ... the most unusual histogram ...  :wink: ...
... I knew, there is still coming something ...

Title: Re: [req mod] histogram
Post by: mawenzi on March 11, 2006, 05:12:56 PM
I have make a Backgroundimage for the histogram.

Das ist schlichtweg falsch !
Du hast das Bild von meiner Seite kopiert und mit einer anderen Hintergrundfarbe versehen. Denn wenn du es erstellt hättest, dann wüstest du auch etwas mit den Koordinaten dazu anzufangen. Ich habe nichts dagegen, dass dieses Hintergrundbild zum Histogramm verwendet wird. Ich habe aber etwas dagegen, wenn jemand behauptet er hätte es erstellt obwohl er es definitiv nicht gemacht hat !
Title: Re: [req mod] histogram
Post by: mawenzi on March 11, 2006, 06:07:45 PM
Ich habe oben bereits gesagt, dass ich nichts dagegen habe wenn das Bild verwendet wird.
Ich habe aber etwas gegen deine lächerlichen Ausführungen der Rechtfertigung. Du hast keine Ahnung von der Systematik der Koordinaten, warum das Hauptraster vom Unterraster versetzt ist, warum das Raster so beschriftet ist, welcher Schrifttyp da verwendet wird, angeblich warum das Bild incl. der Beschriftung deckungsgleich mit dem von mir erstellten Vorladebild ist (Du hast Schriftzeilen mit PS entfernt ... . Mein Histogramm-Bild wird komplett incl. Raster vom Script erstellt ... ohne Hintergrund.), geschweige denn wie die Histogramm-Linien in das Koordinatensytem passend integriert werden ... und schreibst dann so einen Müll ! Und sehe dir mal die letzten Beiträge an, die Wörter ... geklaut ... Dieb ... erscheinen nur bei dir !

kehre mal in dich ... mawenzi
Title: Re: [req mod] histogram
Post by: mawenzi on March 11, 2006, 06:56:37 PM
genau das richtige Bild gefunden ... und wenn du dann noch richtig gelesen hättest ... es ist das Vorladebild ... dazu muss man aber wissen wie das Script läuft . Und ich sage es nochmals ( zum 3.mal ? ) : ich habe nichts dagegen wenn das Bild verwendet wird !
Title: Re: [MOD] Histogram
Post by: Chicco on March 20, 2006, 11:56:04 PM
Frage zum Mod nochmal, nachdem ich nun doch wieder auch eingebaut habe.
Vielleicht habe ich es nun auf den drei Seiten übersehen, und einer hat schon mal diesbezüglich gefragt, aber wie sieht es aus, wenn ich ein Foto als Admin lösche? Das davon erstellte Histogramm bleibt bestehen, gelle? :?
Title: Re: [MOD] Histogram
Post by: mawenzi on March 21, 2006, 12:20:38 AM
... Das davon erstellte Histogramm bleibt bestehen, gelle? :?

... Ja .
Title: Re: [MOD-REQ] Histogram
Post by: Chicco on March 21, 2006, 12:25:59 AM
hmmm...

Ist es dann möglich so was im Admin-Panel bei der Funktion Löschen von Bildern , das entsprechende histogramm zu löschen? sowas wie histo+{image_name} oder sowas.... Sonst hat man ja eines Tages unheimlich viele tote Bilder quasi auf seinem Server herumliegen oder muss immer mühevoll per FTP das entsprechende Bild separat löschen....

Dachte ja schon an die Lösung mit evtl. "Neue Bilder checken", aber das reagiert nicht auf die HISTO-Dateien....
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 25, 2006, 06:37:52 PM
Hallo,
habe nun auch versucht, dieses Script in 1.7.2 einzubinden.
Leider passiert hier irgendwie überhaupt nichts.

Lege ich in den Ordner 11 eine hist_PICT0011.png Datei, dann wird diese auch nicht angezeigt. Nur ein durchgestrichenes Bild mit dieser URL:
http://eiber.dyndns.biz/histo.php?hist_image=PICT0011.JPG&hist_file=hist_PICT0011.png&hist_path=data/media/11/

Die codes habe ich so eingefügt:

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 (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,171,205,239);
                        $white=ImageColorAllocate($im_out,255,255,255);
                        $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);
                        }
?>


details.php
Code: [Select]
//-----------------------------------------------------
//--- 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/media/".$cat_id."/";

$ext = substr($hist_image, strpos($hist_image, ".")+1, strlen($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 ------------------------

details.html
Code: [Select]
{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}

Die anderen codes sind von Seite1 übernommen worden
Irgendwie wird bei mir keine Datei erstellt und auch keine angezeigt
Hier noch der Testlink der Seite: http://eiber.dyndns.biz/details.php?image_id=55

Kann mir jemand von Euch bei diesem Problem weiterhelfen?
Danke im Voraus

Gruß
Title: Re: [MOD-REQ] Histogram
Post by: 051276 on March 25, 2006, 06:47:40 PM
Halli Hallo,
geht mir ganz genau wie Dir.
Ich habe nun schon 5 mal hintereinander alles ein- und wieder ausgebaut, aber immer erscheint kein Histogram. Immer nur das durchgestriche Symbol.
Siehe hier http://mikeonline.name/gallery/details.php?image_id=6
Vielleicht hat ja jemand ne Idee an was es liegt.
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 25, 2006, 06:52:36 PM
ruft man bei dir auch die Seite auf http://mikeonline.name/gallery/histo.php?hist_image=DSC_0060.jpg&hist_file=hist_DSC_0060.png&hist_path=data/media/3/ kommen genauso diese Script Fehlermeldungen wie bei mir

Code: [Select]
Warning: imagesx(): supplied argument is not a valid Image resource in /var/www/web21/html/mike/gallery/histo.php on line 12

Warning: Wrong parameter count for max() in /var/www/web21/html/mike/gallery/histo.php on line 27

Warning: Wrong parameter count for max() in /var/www/web21/html/mike/gallery/histo.php on line 28

Warning: Wrong parameter count for max() in /var/www/web21/html/mike/gallery/histo.php on line 29

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 45

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 46

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 47

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 48

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 49

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 50

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 51

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 45

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 46

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 47

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 48

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 49

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 50

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 51

Warning: Division by zero in /var/www/web21/html/mike/gallery/histo.php on line 45

usw........



gruß
Title: Re: [MOD-REQ] Histogram
Post by: Chicco on March 26, 2006, 02:07:58 PM
 :? Hmmm....

Also ihr habt euch genau an die Anleitung von Mawenzi gehalten, oder?

Auch Step 3.1 und 3.2?

Übrigens: Wieso kann ich mir dein Verzeichis auflisten lassen? Sind deine Schreib.- und Leserechte richtig gesetzt?
Wenn ich http://eiber.dyndns.biz/data/media/11/ eingebe im Browser, zeigt er mir den Inhalt dieses Verzeichnisses an. Sollte ja nicht sein, oder? :roll:
Vielleicht liegt es an den Schreib und Leserechte?

Ansonsten kann ich auch keinen Fehler momentan nachvollziehen...das histo.php ist richtig. Habe es mir dem hier vergliechen sowie mit meinem. Alles gleich bis auf das, das ich ein Hintergundbild verwende. Aber das sollte nicht der Fehler bei euch sein.

Ich denke mal, das der einzige, welcher euch dabei helfen kann, der Mawenzi ist.....
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 26, 2006, 02:45:46 PM
Also das mit den Berechtigungen passt, da ja das Verzeichnis von 4images so angelegt wird.

Hab das Script genauso eingebaut und die Zeilen gelöscht wie beschrieben... leider ohne Erfolg.
Das eizige was mich an der Anleitung verwunderte ist diese Zeile: $filepath .... in ... $hist_path umbenennen.
Wenn ich doch die 4 Zeilen löschen muss, dann hab ich keine Variable $filepath mehr in der histo.php

Gruß
Title: Re: [MOD-REQ] Histogram
Post by: Chicco on March 26, 2006, 02:53:52 PM
A ha...Jetzt haben wir den Fehler.....evtl...

so ging es mir nämlich auch anfangs, das ich mich gewundert hatte, warum erst löschen und dann noch umbenennen, wenn nichts mehr da ist..

Das umbenennen ist aber vo anders gemeint. Du musst sämtliche "$filepath" in der histo.php in "$hist_path" umbenennen. Genauso alles andere...

Also alle "$image" variablen in "$hist_image"
alle "$path" in "$hist_path"
und alle "$filepath" in "$hist_path" umbenennen.

Durchsuch einfach deine histo.php nach diesen Variablen und benenne sie dann entsprechend um. Fertig.

Jetzt müsste es aber dann funtzen, oder?
Title: Re: [MOD-REQ] Histogram
Post by: Chicco on March 26, 2006, 03:01:13 PM
Okay....Sehe gerade, das du bereits alle schon umbenannt hast....Ähmm, auf die Schnelle sehe ich nun auch keine Varaibale "$filepath" mehr, ausser in der Zeile, welche man aber löschen soll....

Also hier ist mal mein 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 (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);
                        }
?>



Kopier dir einfach mal diesen Code.....Vielleicht ist doch irgendwo ein Kommafehler drin oder sowas....
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 26, 2006, 03:01:56 PM
habe ich ja bereits getan ;)
Aber wenn ich diese Zeilen lösche:
Code: [Select]
                       $image = $_REQUEST['image'];
                        $filepath = $_REQUEST['filepath'];
                        $path = "albums/".$filepath;

                        $hist_file="hist_".substr($image,0,strlen($image)-4).".png";
dann habe ich keine weiter variable $filepath in der histo.php
Den Rest hab ich bereits umbenannt und zig mal kontolliert ob ich nichts vergessen habe.

Gruß
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 26, 2006, 03:05:31 PM
Danke Chicco für deine Hilfe.
habe nun deine histo.php online aber nach wie vor der selbige Fehler:
http://eiber.dyndns.biz/histo.php?hist_image=PICT0011.JPG&hist_file=hist_PICT0011.png&hist_path=data/media/11/

Code: [Select]
Warning: imagesx(): supplied argument is not a valid Image resource in C:\wwwroot\xampp\htdocs\histo.php on line 15

Warning: Wrong parameter count for max() in C:\wwwroot\xampp\htdocs\histo.php on line 30

Warning: Wrong parameter count for max() in C:\wwwroot\xampp\htdocs\histo.php on line 31

Warning: Wrong parameter count for max() in C:\wwwroot\xampp\htdocs\histo.php on line 32

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 48

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 49

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 50

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 51

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 52

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 53

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 54

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 48

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 49

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 50

Warning: Division by zero in C:\wwwroot\xampp\htdocs\histo.php on line 51

Gruß
Alex
Title: Re: [MOD-REQ] Histogram
Post by: Chicco on March 26, 2006, 03:18:47 PM
HMMMMM :cry: :cry: :cry:

Also dann liegt es schon mal NICHT an der HISTO.PHP.......und wohl auch kaum an der Details.php....

Somit ein durchaus grösseres Problem, bei dem dir wohl echt nur einer helfen kann, wie ich bereits schon erwähnte....Der "Mawenzi".

Wenn es dann mal funktioniert, würde es mich trotzdem interessieren, an was es lag.

Sorry, das ich nicht helfen konnte....

Trotzdem einen schönen Sonntag. Auch wenn es gerade pisst....zumindest bei uns... :?
Title: Re: [MOD-REQ] Histogram
Post by: cappuccino on March 26, 2006, 03:27:01 PM
irgendwas muss es mit dem script aber zu tun haben.
gehe schon davon aus das es evt an der details.php liegt da wenn ich zub die zeile:
Code: [Select]
$hist_file="hist_".substr($image,0,strlen($image)-4).".png";
in die histo.php wieder übernehme, dann wird zumindest schon mal die hist_*imagename*.png angelegt die dann auch sichtbar ist.
Dieses dann aber im falschen Verzeichnis.
Histogramm wird aber keines erzeugt.
Vielleicht liegt es an der verwendeten PHP Version?
Hatte zuvor PHP5 mit deren schon das EXIF Script nicht funktionierte.
Und momentan verwende ich PHP4.4.1 mit diesen Optionen:
Code: [Select]
GD Support  enabled 
GD Version  bundled (2.0.28 compatible) 
FreeType Support  enabled 
FreeType Linkage  with freetype 
T1Lib Support  enabled 
GIF Read Support  enabled 
GIF Create Support  enabled 
JPG Support  enabled 
PNG Support  enabled 
WBMP Support  enabled 
XBM Support  enabled 

Gruß und Danke
Alex
Title: Re: [MOD-REQ] Histogram
Post by: *User* on April 02, 2006, 10:17:12 AM
Hallo zusammen,

gibt es nun schon eine Möglichkeit das das entsprechende Histogrammbild automatisch mit gelöscht wird, wenn ich eine Bilddatei lösche?

Cu
Title: Re: [req mod] histogram
Post by: wallpapers on April 23, 2006, 10:03:31 PM
@ cheribibi,
an English translation is coming soon ... :wink:
When is the translation coming.  :oops:

I get a red X and i don't know what to do or what it can be.
here you can see what i mean: http://wallpapers.sexy-picz.com/details.php?image_id=18

I hope if someone have a solution  :lol:
Title: Re: [MOD-REQ] Histogram
Post by: wallpapers on April 23, 2006, 10:34:30 PM
Okay....Sehe gerade, das du bereits alle schon umbenannt hast....Ähmm, auf die Schnelle sehe ich nun auch keine Varaibale "$filepath" mehr, ausser in der Zeile, welche man aber löschen soll....

Also hier ist mal mein 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 (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);
                        }
?>



Kopier dir einfach mal diesen Code.....Vielleicht ist doch irgendwo ein Kommafehler drin oder sowas....

Problem solved by the code above  :D :D :D
thanks Chicco  :lol:
Title: Re: [MOD-REQ] Histogram
Post by: Tomi on April 24, 2006, 12:58:07 AM
I surrender..  :cry:
How change background..??

Quote
$im_out = imageCreate (280, 164);with:


Quote
$im_out = imageCreateFromPNG ("background.png");

it does not act..


and
Quote
histogramm.php?hist_image=background.jpg&hist_path=data/media/88/&hist_file=02_hist_background.png
mistake line..

who will explain what and where..
Title: Re: [MOD-REQ] Histogram
Post by: qwertz on April 27, 2006, 09:08:42 PM
danke für den mod! allerdings wird das histogramm nicht unter allen bildern gezeigt. woran kann das liegen?
(beispiel: http://www.xtrapix.net/details.php?image_id=32)

viele grüße

qwertz

thx for the mod! but, by some pictures on my page, there is no histogram seen. for example: http://www.xtrapix.net/details.php?image_id=32

much greetings

qwerty  :wink:
Title: Re: [MOD-REQ] Histogram
Post by: mawenzi on April 27, 2006, 10:44:01 PM
Hallo qwertz,

dein Bild mit der image_id=32 hat den Dateinamen : 6.11.2004_018kleinfc2.jpg

Alle Bilddateinen mit "Punkten" im Dateinamen fallen beim Histogramm raus, da zur Bestimmung der zulässigen Dateiextension in diesem MOD bis zum ersten "Punkt" im Dateinamen gesucht wird und alles dahinter dann Dateiextension angesehen wird. Und was dann bei deiner Datei übrig bleibt ist sicher nicht als "Authorisierter" Dateityp gelistet. Somit fällt die Datei für ein Histogramm raus.

Die Datei mit Dateinamen 6_11_2004_018kleinfc2.jpg z.B. erzeugt ein Histogramm ...  :wink:

mawenzi
Title: Re: [MOD-REQ] Histogram
Post by: qwertz on April 27, 2006, 11:42:47 PM
danke schön!!!  :D werde ich gleich ändern!
Title: Re: [MOD] Histogram
Post by: Chicco on May 08, 2006, 11:25:45 PM
Also nochmals bezüglich des zusätzlichen Löschen vom Histogramm-Bild.

Dieser Teil hier in der member.php ist doch für das löschen des Bildes sowie dessen Thumbnails zuständig, oder:
Code: [Select]
$txt_clickstream = $lang['image_delete'];

  $sql = "DELETE FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id";
  $del_img = $site_db->query($sql);

  if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file'])) {
    @unlink(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']);
  }
 
  if (!empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file'])) {
    @unlink(THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']);
  }

Kann ich diesen Bereich nicht nun erweitern, das er zusätzlich auch noch das Bild mit dem Zusatz "histo_" vorne dran löscht?

Also er löscht zum Beispiel das Bild test.jpg. Jetzt soll es auch gleich das Bild bzw. Datei "histo_test.png" löschen.
Title: Re: [MOD] Histogram [MOD] check new images
Post by: mohab on May 12, 2006, 08:56:08 PM
Also das Histogram Mod funzt sehr fein doch nun hab ich ein gröberes problem.
in zusamenhang mit them autothumb Mod
autothumb versucht thumbs von den hist_****.png bilder zu erstellen
was nicht sinn der sach ist
gibt es eine möglichkeit das zu umgehen.

Ob der thread jetzt in Check new Images mod oder in hist reingehört ?
Das problem hab ich erst seit Hist mod instaliert ist und natürlich kommen dann auch
die hist bilder auf die start seite als last added imag.
lg mohab
Title: Re: [MOD] Histogram
Post by: mawenzi on May 12, 2006, 10:06:01 PM
Deshalb ist es besser die Histogramme nicht im Kategorieordner, sondern in einem extra Ordner zu speichern. Um das abzuändern wäre folgendes zu erledigen.

1. einen neuen Ordner zum Speichern der Histogramme anlegen z.B.: 
/data/histo

2. im Code für das Histogramm in der details.php finde :
Code: [Select]
$hist_path = "data/media/".$cat_id."/";
und ändere in
Code: [Select]
$hist_path = "data/histo/";

damit wäre das Problem erledigt ...  :wink:

mawenzi
Title: Re: [MOD] Histogram
Post by: Chicco on May 18, 2006, 09:31:58 AM
Ich probier es nun nochmals auf English (Gott steh mir bei)

Is it then possible like that which in the Admin panel with the function deletion of pictures to delete the appropriate histogram? sowas like histo+ {image_name} or other…. Otherwise one has a daily terribly many dead pictures quasi on its server to lie about or must always laboriously by ftp the appropriate picture separately delete….

Sorry for my English
Title: Re: [MOD] Histogram
Post by: om6acw on May 25, 2006, 11:14:11 PM
Deshalb ist es besser die Histogramme nicht im Kategorieordner, sondern in einem extra Ordner zu speichern. Um das abzuändern wäre folgendes zu erledigen.

1. einen neuen Ordner zum Speichern der Histogramme anlegen z.B.: 
/data/histo

2. im Code für das Histogramm in der details.php finde :
Code: [Select]
$hist_path = "data/media/".$cat_id."/";
und ändere in
Code: [Select]
$hist_path = "data/histo/";

damit wäre das Problem erledigt ...  :wink:

mawenzi


not working for me, I have this error

Code: [Select]
Warning: imagecreatefromjpeg(data/histo/DSC_9510.jpg): failed to open stream: No such file or directory in /home/myanimw/public_html/4images/histo.php on line 14

Warning: imagesx(): supplied argument is not a valid Image resource in /home/myanimw/public_html/4images/histo.php on line 15

Warning: Wrong parameter count for max() in /home/myanimw/public_html/4images/histo.php on line 30

Warning: Wrong parameter count for max() in /home/myanimw/public_html/4images/histo.php on line 31

Warning: Wrong parameter count for max() in /home/myanimw/public_html/4images/histo.php on line 32

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 48

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 49

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 50

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 51

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 52

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 53

Warning: Division by zero in /home/myanimw/public_html/4images/histo.php on line 54

here is my 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 (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);
                        }
?>


and here part from details.php

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/histo/";

$ext = substr($hist_image, strpos($hist_image, ".")+1, strlen($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" => "Histogram:",
   "histogramm_image" => $histogramm_image
));
//--- Ende Histogramm 27.02.2006 ------------------------

it's something wrong???
Title: Re: [MOD] Histogram
Post by: l1some on June 04, 2006, 01:25:01 AM
Got this mod working with 4images 1.7.1-inter/with phpnuke 7.4 WORKS GREAT!!
Title: Re: [MOD] Histogram
Post by: SAD on June 08, 2006, 09:11:36 AM
Quote
Warning: imagesx(): supplied argument is not a valid Image resource in /home/myanimw/public_html/4images/histo.php on line 15

in histo.php add after
Code: [Select]
//      Free to use and change, provided you keep these lines :)
//

this
Code: [Select]
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 = "";
}
Title: Re: [MOD] Histogram
Post by: mawenzi on June 08, 2006, 10:16:59 AM
@Sergey
... I think you already found an answer  ...  :wink:
Title: Re: [MOD] Histogram
Post by: ahbut on July 03, 2006, 06:14:05 AM
sorry, due to hardly any english on this topic, I did install the mod, but not showing anything.
isn't there suppose to have a background image in the image folder as well for this to work??
or the hist.php, suppose to draw everything??
if there's a background image required, anyone have it that I can download off??
Title: Re: [MOD] Histogram
Post by: troopers on August 21, 2006, 04:46:25 PM
With SAD's soloution it works fine.

thx a lot :D
Title: Re: [MOD] Histogram
Post by: Eosbirdy on September 20, 2006, 09:08:04 PM
     
Hallo Mawenzi,

ich habe versucht das Histogram Mod komplett so einzubinden wie es hier beschrieben ist. Ich bekomme keine Fehlermeldungen, aber es werden keine Histogram Bilder angezeigt. Bei dem Aufruf des Bildes in meiner Galerie steht zwar als text Histogramm mit einem kleinen Viereck wie als aob er das Bild nicht findet.
Hier mein Link:

http://www.rainer-vogel.de/galerie/details.php?image_id=36

Ich habe komplett die histo.php im Ordner /data/histo. Die details.html im Template Ordner und die details.php im Root. Den Quellcode habe ich aus deinen vorhergehenden Postings komplett übernommen. Würdest du mir bitte helfen?

Danke schonmal, Birdy.
Title: Re: [MOD] Histogram
Post by: udo w. on September 21, 2006, 02:45:15 PM
Hallo zusammen,

ich hab genau das gleiche Problem...
Beim Bearbeiten der "histo.php ist mir auch aufgefallen, der der Eintrag "$filepath" nicht vorhanden ist ...  :?:

Hängt es vielleicht damit zusammen?

Grüßle
Udo
Title: Re: [MOD] Histogram
Post by: Eosbirdy on September 21, 2006, 07:03:31 PM
Habe jetzt alles wieder ein und ausgebaut. Ich bin schon fast am verzeifeln. Warum zeigt er mir nichts an??  8O Wer könnte mir denn mal die details.html, die histo.php und die details.php von einer lauffähigen Seite zu mailen? Wie gesagt bei mir zeigt er nur den Text "Histogram" und ein kleines Viereck an.
Würde mich freuen über eine Antwort. Gut Udo, das ich nicht der einzige bin wo es nicht klappert.. :roll: :roll:
Title: Re: [MOD] Histogram
Post by: udo w. on September 21, 2006, 09:13:45 PM
Habe jetzt alles wieder ein und ausgebaut. Ich bin schon fast am verzeifeln. Warum zeigt er mir nichts an??  8O Wer könnte mir denn mal die details.html, die histo.php und die details.php von einer lauffähigen Seite zu mailen? Wie gesagt bei mir zeigt er nur den Text "Histogram" und ein kleines Viereck an.
Würde mich freuen über eine Antwort. Gut Udo, das ich nicht der einzige bin wo es nicht klappert.. :roll: :roll:

Ich hab fast den ganzen Tag damit verbracht, das Histogramm ans laufen zu bekommen - und?  weißes Blatt mit rotem Kreuz.... :thumbdown:
Keine Ahnung, was ich noch anstellen soll.... :cry: :cry: :cry:
Vielleicht hat ja wirklich jemand erbarmen und schickt uns seine Daten... :)

Udo
Title: Re: [MOD] Histogram
Post by: izone on September 22, 2006, 10:48:56 AM
@ mawenzi  or/amd V@no

I've installed this mod and it works great, thank you!

The only part that I still cann't make it works is this one:

Quote
1. einen neuen Ordner zum Speichern der Histogramme anlegen z.B.: 
/data/histo

2. im Code für das Histogramm in der details.php finde :

Code:
$hist_path = "data/media/".$cat_id."/";
und ändere in

Code:
$hist_path = "data/histo/";

damit wäre das Problem erledigt ... 

As some other here has problem with it. Could you please give us some more help on this?

When I make these changes the histogram picture wont show att all! Is there any more places which must changes?

I and many other here will appreciate it much more!

Best Regards!
Title: Re: [MOD] Histogram
Post by: izone on September 23, 2006, 10:40:06 AM
 8O

Nobody knows how to fix it? :cry:
Title: Re: [MOD] Histogram
Post by: udo w. 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
Title: Re: [req mod] histogram
Post by: pantograf 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.
Title: Re: [MOD] Histogram
Post by: __G__ 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

Title: Design des Histogramms
Post by: Phil87 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
Title: Re: [MOD] Histogram
Post by: mawenzi 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 (http://klick.kl.funpic.de/board.php) !
Title: Re: [MOD] Histogram
Post by: Phil87 on November 21, 2006, 07:28:20 PM
Danke!
Durch dein Forum haben sich alle meine Fragen erledigt!

Gruß
Phil
Title: Re: [MOD] Histogram
Post by: desperate_housewif 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.
Title: Re: [MOD] Histogram
Post by: Acidgod on February 22, 2007, 02:33:32 PM
so wie auf www.sascha-droemer.de ???
Title: Re: [MOD] Histogram
Post by: desperate_housewif on February 22, 2007, 04:57:29 PM
Ja, genauso. Auch für Histogramm und für Kommentare!!!
Title: Re: [MOD] Histogram
Post by: Acidgod on February 22, 2007, 05:51:00 PM
meinste das kannste nicht "klauen"? *g*
Title: Re: [MOD] Histogram
Post by: mawenzi on February 22, 2007, 05:55:46 PM
... einfach ein Java-Toggle-Script (http://www.google.com/search?hl=de&rls=com.microsoft%3Aen-US&q=Java+Toggle+Script+&btnG=Suche&lr=) verwenden ...
... so etwa wie hier (http://klick.kl.funpic.de/details.php?image_id=3558) für IPTC- und EXIF-Info ...
Title: Re: [MOD] Histogram
Post by: desperate_housewif 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?
Title: Re: [MOD] Histogram
Post by: Joss 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.
Title: Re: [MOD] Histogram
Post by: desperate_housewif 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?
Title: Re: [MOD] Histogram
Post by: Joss 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.
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 10:02:01 PM
Hi all,
it seems to me, that histogram is wrong in some case. Look for this:
http://gallery.imagemaster.ru/img8184.htm
http://gallery.imagemaster.ru/img8103.htm

You can save the pictures and open them in Photoshop and compare histograms. I think the problem arises in case when too many pixels in shadows (left side of histogram). It looks like a non-normalize histogram. Does anybody have any ideas?

Also, there is another problem - the histogram images don't remove from server when we remove the the image. Does anyone have a solution?

Thanks!
Title: Re: [MOD] Histogram
Post by: Acidgod on April 13, 2007, 10:06:23 PM
only scaling is diffent i think...
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 10:13:08 PM
Acidgod,
thanks for the reply. I think so. But scaling is different only in some cases (as I've describe above). So, probably there is a decision of this problem? Anyway, I'll try to understand the code and find a solution.
Title: Re: [MOD] Histogram
Post by: Acidgod on April 13, 2007, 10:27:12 PM
can make some screenshots? where i can see the differents between Photoshop an this Mod?
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 10:32:51 PM
Ok, I'll prepare it now.
But I found the "root of evil", it's a following code:

Code: [Select]
$max_value=max($max)/150;
 $m[0]=max($r);
 $m[1]=max($b);
 $m[2]=max($g);
 $max_rgb=max($m)/150;

If we change 150 to 450 e.g., on my examples we get a right scaling histogram. But for other images,  the histogram will overflow top line (sorry for my English, I'm from Russia).  :oops:
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 10:38:04 PM
There is an example of histograms for the image:
http://gallery.imagemaster.ru/img8103.htm

Photoshop histogram is above, 4images is below.
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 10:47:57 PM
I'm sorry, why I can't see this thread in "Mods & Plugins (Releases & Support)" branch?
Title: Re: [MOD] Histogram
Post by: Acidgod on April 13, 2007, 10:57:58 PM
(sorry for my English, I'm from Russia).  :oops:

And i am German... (o:
My English is not even better... *g

I'm sorry, why I can't see this thread in "Mods & Plugins (Releases & Support)" branch?

Too much sticky Threads... )o:
http://www.4homepages.de/forum/index.php?board=15.200
There you can find it... (11 site)

And that is a problem only with black and white images, right?
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 11:06:27 PM
Thanks! :) I already tried so and so....
No, the problem not only with b/w images. It seems to me that the problem with all pictures (b/w and color) which have a lot of 0,0,0 and 255,255,255 pixels. In other words with images who have a "splash" in shadow/higlights.
Title: Re: [MOD] Histogram
Post by: Joss on April 13, 2007, 11:38:25 PM
I think that the following algorithm can fix the situation (I'll describe it by words) :

1. In
Code: [Select]
$max_value=max($max)/150; and $max_rgb=max($m)/150;
we must ignore values with indexes with range (for example) 0 ... 20, and from 235 ... 255. Especially because in that range can get black/white frame of image.

2. Instead of search the ONE max value we must find the max value with some density (by other words, the max values is a value which have some pixels in 20..235 range (e.g. 10 or 20).
Title: Re: [MOD] Histogram
Post by: Frank Götze on June 04, 2007, 06:55:56 AM
Hi mawenzi,

thanks a lot for this great mod.  :D

Frank.
Title: Re: [MOD] Histogram
Post by: mawenzi on August 09, 2007, 10:18:57 PM
Hallo Ivan,
... so wie es aussieht, hast du ja die Version von meiner Website installiert ...
... werde mir die Sache mal ansehen ...
... aber wenn es zunächst bei dir mit einer .htacess funktioniert, dann bist du ja schon ein Schritt weiter ...
... und wenn es an "register_globals on" (auch meine Einstellung) liegt, dann ist es ja ein Serverproblem ...
Title: Re: [MOD] Histogram
Post by: barabangel on October 02, 2007, 12:38:22 PM
My histogram is...

(http://angel.dxbg.com/histo1.gif)


How to make it look like that one.

(http://angel.dxbg.com/histo2.gif)
Title: Re: [MOD] Histogram
Post by: mawenzi on October 02, 2007, 01:09:35 PM
... here ... http://klick.kl.funpic.de/files.php ...
Title: Re: [MOD] Histogram
Post by: barabangel on October 02, 2007, 02:16:05 PM
 :D Thanks!
Title: Re: [MOD] Histogram
Post by: bacterio on December 22, 2007, 10:17:58 PM
Over the past few days I have in my log the error: PHP Warning: Division by zero in / home / miweb.com / data / htdocs / gallery / histo.php on line 71, 72, 73, 74, 75 ..... ..

(I have been two years without that error)

These lines are:

Quote
                                imageLine($im_out, $i+14, 157, $i+14, 157-($max[$i]/$max_value),$white);
                                imageLine($im_out, $i+13, $ry, $i+14, 157-($r[$i]/$max_rgb), $red);
                                imageLine($im_out, $i+13, $gy, $i+14, 157-($g[$i]/$max_rgb), $green);
                                imageLine($im_out, $i+13, $by, $i+14, 157-($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);

Versión de PHP is:  4.4.7 

Any thoughts?

Title: Re: [MOD] Histogram
Post by: thunderstrike on December 22, 2007, 11:16:36 PM
What is exact line for division zero error ?
Title: Re: [MOD] Histogram
Post by: bacterio on December 23, 2007, 10:55:58 AM
Quote
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  imagecreatefromjpeg(reportero.jpg) [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: failed to open stream: No such file or directory in /home/miweb.com/data/htdocs/galeria/histo.php on line 37
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  imagesx(): supplied argument is not a valid Image resource in /home/miweb.com/data/htdocs/galeria/histo.php on line 38
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Wrong parameter count for max() in /home/miweb.com/data/htdocs/galeria/histo.php on line 53
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Wrong parameter count for max() in /home/miweb.com/data/htdocs/galeria/histo.php on line 54
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Wrong parameter count for max() in /home/miweb.com/data/htdocs/galeria/histo.php on line 55
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 71
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 72
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 73
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 74
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 75
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 76
[Sun Dec 23 01:48:13 2007] [error] PHP Warning:  Division by zero in /home/miweb.com/data/htdocs/galeria/histo.php on line 77

Lines 37 and 38:

Quote
                        $im=imagecreatefromjpeg($hist_path.$hist_image);
                        for($i=0;$i<imagesx($im);$i+=2)

Lines 53 to 55:

Quote
                        $m[0]=max($r);
                        $m[1]=max($b);
                        $m[2]=max($g);

Lines 71 to 77:

Quote
                                imageLine($im_out, $i+14, 157, $i+14, 157-($max[$i]/$max_value),$white);
                                imageLine($im_out, $i+13, $ry, $i+14, 157-($r[$i]/$max_rgb), $red);
                                imageLine($im_out, $i+13, $gy, $i+14, 157-($g[$i]/$max_rgb), $green);
                                imageLine($im_out, $i+13, $by, $i+14, 157-($b[$i]/$max_rgb), $blue);
                                $ry=157-($r[$i]/$max_rgb);
                                $gy=157-($g[$i]/$max_rgb);
                                $by=157-($b[$i]/$max_rgb);

This happens to me in two different galleries, but the best thing is that if the histogram is generated .....

I think it's problem of the library gd2 .... I do not know.
Title: Re: [MOD] Histogram
Post by: thunderstrike on December 23, 2007, 01:11:55 PM
Quote
I think it's problem of the library gd2 .... I do not know.

Is show error for one image or all image ?
Title: Re: [MOD] Histogram
Post by: bacterio on December 23, 2007, 10:56:16 PM
Hello Thunderstrike

It happens with new images or old, it does sometimes with any image.
Title: Re: [MOD] Histogram
Post by: thunderstrike on December 23, 2007, 10:59:00 PM
If check in FTP for file structure - all ok in thumb and media folder ? Is look like alter image ...
Title: Re: [MOD] Histogram
Post by: bacterio on December 23, 2007, 11:02:10 PM
No, it's not a problem for permits, are all 777 and passes in any category.

I have two galleries 4homepages on the same server and I ocrre the same. Since a few days ago.
Title: Re: [MOD] Histogram
Post by: thunderstrike on December 23, 2007, 11:19:50 PM
Quote
No, it's not a problem for permits, are all 777 and passes in any category.

I no ask for permission. I ask if file structure is ok (kb, bytes) for all file. Is possible some alter image ...
Title: Re: [MOD] Histogram
Post by: skiemor on January 19, 2008, 07:23:40 PM
Danke, sehr schöner MOD!  :D
Title: Re: [MOD] Histogram
Post by: mawenzi on January 26, 2008, 11:39:02 AM
@all
... I redesigned this MOD with some fixes ...
... you can download all neccesary files and the installations instruction ... here (http://klick.kl.funpic.de/files.php) ...

@alle
... ich habe den MOD neu gestaltet mit einigen Fixes ...
... du kannst alle notwendigen Dateien und die Installationsanweisung downloaden ... hier (http://klick.kl.funpic.de/files.php) ...
Title: Re: [MOD] Histogram
Post by: rubberduck on January 26, 2008, 03:48:40 PM
Wenn es um die Global Sache geht, dann füge mal in die erste Zeile der histogramm.php

Code: [Select]
$hist_image_id = $_GET['hist_image_id'];
ein.

Title: Re: [MOD] Histogram
Post by: mawenzi on January 26, 2008, 04:09:57 PM
Hallo Ivan,

Wenn es um die Global Sache geht, dann füge mal in die erste Zeile der histogramm.php

Code: [Select]
$hist_image_id = $_GET['hist_image_id'];
ein.



... genau das behebt das Problem ... ;)
... in meinem Downloadpaket ist aber dieser Fix bereits enthalten ...
... also diese Zeile einfügen ... oder die histogramm.php nochmals downloaden ...
Title: Re: [MOD] Histogram
Post by: rubberduck on January 27, 2008, 12:53:13 AM
für php5 gerüstet.

Naja, hat ja nicht direkt mit PHP5 zu tun, eher mit den Core Einstellungen für register_globals.

Aber Hauptsache es funktioniert :)

Title: Re: [MOD] Histogram
Post by: mawenzi on January 27, 2008, 01:46:20 AM
@ Ivan
... schön das Histogramm bei dir wieder online zu sehen ... ;)
Title: Re: [MOD] Histogram
Post by: mawenzi on March 10, 2008, 08:31:54 PM
... was bedeutet ... "wenn keines (Bild) vorhanden ist" ...

- wenn kein Bild vorhanden ist, dann gibt es keine Detailseite auf der ein Histogramm gezeigt werden könnte ...
- wenn auf der Detailseite statt eines Bildes z.B. ein Video o.d.gl. gezeigt wird, so wird auch kein Histogramm gezeigt ...
- für welchen Dateityp die Erzeugung und Einblendung des Histogramms erfolgen soll, legst du über die Extensionen fest ...

... worin besteht das Problem ... ?
Title: Re: [MOD] Histogram
Post by: mawenzi on March 10, 2008, 09:01:49 PM
... welche Histogramm-Version und Einbindung in die details.php verwendest du ... ?
... ich hoffe doch stark ... diese hier (http://klick.kl.funpic.de/files.php) ... und nicht die vom Thread-Anfang ...
... und die if-Schleife ist Bestandteil der Einbindung in die details.php ... !
... die histogram.php wird nur über die details.php aufgerufen ... !
... und dort auch nur, wenn der Dateityp für ein Histogramm definiert ist ... (if-Schleife)  !
... d.h. wird die histogram.php aufgerufen, so muss auch ein Bild vorliegen ... !
... ansonsten verwendest du eine falsche Einbindung oder hast falsche Dateitypen definiert ...

Title: Re: [MOD] Histogram
Post by: mawenzi on March 10, 2008, 09:29:34 PM
das histogramm wird angezeigt, auch wenn kein bild vorhanden ist.
ist das bei dir auch so?

... ich verstehe das nicht ... oder dein Deutsch ist mir zu südlich ...
... wenn es kein Bild gibt, dann kann es doch keine Detailseite geben, wo ein Histogramm gezeigt wird ... !?!
... URL please ...
Title: Re: [MOD] Histogram
Post by: mawenzi on March 10, 2008, 10:43:06 PM
... wenn keine Bilddatei vorhanden ist, jedoch ein Datenbankeintrag ...  :roll:
... so kannst du zur Unterdrückung des Histogramms für die nicht vorhandene Biddatei diese if-Schleife verwenden ...

Code: [Select]
if (file_exists("data/media/".$image_row['cat_id']."/".$image_row['image_media_file'].") {
...
}
Title: Re: [MOD] Histogram
Post by: mawenzi on March 26, 2008, 10:38:20 PM
Hallo Ivan,

... kann ich nicht ganz nachvollziehen ...
... bei mir sind alle Attribute : -rw-r--r-- ...
Title: Re: [MOD] Histogram
Post by: Rembrandt on May 06, 2008, 03:58:23 PM
Hi!
sagt mal von euch schon jemand den mod am "mobile server" zum laufen gebracht?

mfg Andi
Title: Re: [MOD] Histogram
Post by: mawenzi on May 06, 2008, 07:35:31 PM
@Rembrandt
... ich gehe mal davon aus, dass du das Erstellen von Histogramm-Bildern meinst ...
... das Anzeigen bereits generierter Histogramm-Bilder funktioniert definitiv ...
... das Erstellen muss ich auch erst mal testen ...
Title: Re: [MOD] Histogram
Post by: Rembrandt on May 06, 2008, 07:49:08 PM
Âbend!

ja beim erstellen
Quote
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 48, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 49, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 50, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 51, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 52, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 53, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
[client 127.0.0.1] PHP Warning:  Division by zero in W:\\www\\4images\\histo.php on line 54, referer: http://localhost/4images/details.php?image_id=36&sessionid=7af9f9034abae5225a91ffd952d12f0f
aber ich nehme an das ganz einfach die bilder nicht gefunden werden.

mfg Andi
Title: Re: [MOD] Histogram
Post by: KurtW on May 06, 2008, 08:09:31 PM
hallo,

Quote
W:\\www\\4images\\histo.php

kurz mal ne Frage:
sollte der link nicht so lauten?
Quote
W:\www\4images\histo.php


KurtW
Title: Re: [MOD] Histogram
Post by: Rembrandt on May 06, 2008, 08:25:17 PM
ja und welcher soll das sein, php5 verwende ich nicht, und die zeile mit global ist eingetragen.

auf meiner online seite funktioniert es ja auch wunderbar.
hallo,

Quote
W:\\www\\4images\\histo.php

kurz mal ne Frage:
sollte der link nicht so lauten?
Quote
W:\www\4images\histo.php


KurtW
hat mich auch schon gewundert, nur woher kommt das?

mfg Andi
Title: Re: [MOD] Histogram
Post by: sigma. on October 18, 2008, 06:09:09 PM
Hello everyone,

I just tried installing this mod. The Histogram image does not display. Shows Missing Image Icon. Does anyone know the solution?
I cant read German and google translate isn't really helping that well.
Title: Re: [MOD] Histogram
Post by: V@no on October 18, 2008, 08:25:54 PM
I don't see any possible way anyone could help with such info ;)
link to the site where the histogram is installed might help though
Title: Re: [MOD] Histogram
Post by: sigma. on October 18, 2008, 08:31:47 PM
Sorry V@no, your right. Heres an example

http://www.cydonian.com/photos/img1761.htm

Title: Re: [MOD] Histogram
Post by: rubberduck on October 19, 2008, 12:59:12 AM
Code: [Select]
http://www.cydonian.com/photos/histo.php?hist_image=IMG_2929_edited-1.jpg&hist_file=hist_IMG_2929_edited-1.png&hist_path=data/media/historical/
The requested URL /photos/histo.php was not found on this server.

Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 03:01:18 AM
Odd.
I renamed the histogramm.php (from mawenzi website) to histo.php
still doesnt work.
and that link you posted is now getting a slew of errors
Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 04:03:46 AM
I removed 2 blank empty lines at the end (?>) of the histo.php file. error warnings are gone but it now shows this

Code: [Select]
An unexpected error occured. Please try again later.

http://www.cydonian.com/photos/histo.php?hist_image=IMG_1113_edited-1.jpg&hist_file=hist_IMG_1113_edited-1.png&hist_path=data/media/historical/ (http://www.cydonian.com/photos/histo.php?hist_image=IMG_1113_edited-1.jpg&hist_file=hist_IMG_1113_edited-1.png&hist_path=data/media/historical/)
Title: Re: [MOD] Histogram
Post by: V@no on October 19, 2008, 09:35:34 AM
login as administrator, it should show you more details about the error.
Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 03:42:35 PM
unfortunately the error log shows no information, no matter how many times i try to access that link.

Could someone try and translate Mawenzi's installation notes to english?
Title: Re: [MOD] Histogram
Post by: KurtW on October 19, 2008, 04:16:18 PM
Hi sigma,

http://www.cydonian.com/photos/histo.php?hist_image_id=1758
is working  :wink:
But not in page  8O

Modcode:
Quote
3.1 Der folgende Code ist aus der histo.php zu löschen.
=> Delete the following code in histo.php


Quote
3.2 Alle folgenden Tags in der histo.php sind wie folgt umzubenennen.
=> Rename the following tags in histo.php


Kurt
Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 06:22:11 PM
This is what my histo.php looks like. Downloaded from Mawenzi's website yesterday. Renamed histogramm.php to histo.php

Dont see what I should delete. Looks like Mawenzi updated the php recently?


Edit by mawenzi :

Wenn man etwas von meiner Website herunterläd, dann sollte man es auch komplett machen ... incl. aller erforderlichen Dateien und Änderungen die dort angeboten sind und dann natürlich auch die dazugehörige Einbauanleitung beachten. Wie vorne zu lesen ist, habe ich die Modifikation "Histogramm" optmiert und biete sie komplett zum Download auf meiner Seite an. Und wie Kurt einige Post später schon richtig festgestellt hat, handelt es sich dabei um eine andere Versionen als die zum Anfang dieses Threads zu finden ist.

Also nicht Äpfel mit Birnen verwechseln und sich noch darüber beschweren, dass die Birne nach Apfel schmeckt ... ;)
Title: Re: [MOD] Histogram
Post by: KurtW on October 19, 2008, 06:41:47 PM
Code: [Select]
$hist_image_id=$_GET['hist_image_id'];
where does the histo.php found this value  :?: => not in the histo.php link from details.php :wink:


i thing, this are 2 different versions for the histogram....

test this in details.php
search:
Code: [Select]
   $histogramm_image = "<img src='histo.php?hist_image=".$hist_image."&hist_file=".$hist_file."&hist_path=".$hist_path."' border=\"1\">";replace with:
Code: [Select]
   $histogramm_image = "<img src=\"histo.php?hist_image_id=".$image_row['image_id]."\" border=\"1\">";

Kurt
Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 06:53:01 PM
Code: [Select]
Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/cydonian/public_html/photos/details.php on line 85
:(
Title: Re: [MOD] Histogram
Post by: KurtW on October 19, 2008, 06:59:34 PM
sorry
Code: [Select]
$histogramm_image = "<img src=\"histo.php?hist_image_id=".$image_row['image_id']."\" border=\"1\">";
Title: Re: [MOD] Histogram
Post by: sigma. on October 19, 2008, 07:01:59 PM
Works! Thank you Kurt!
Title: Re: [MOD] Histogram
Post by: KurtW on October 19, 2008, 07:02:36 PM
 :wink:
Title: Re: [MOD] Histogram
Post by: V@no on October 19, 2008, 07:38:53 PM
You might want add proper headers as well:
aboveif (file_exists($hist_path . $hist_file)) {

insert
header( 'Content-type: image/png' );
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 10, 2009, 10:27:30 AM
Im having big problems with 1.7.6 and using php5

site:
http://www.thelifephotography.com/details.php?image_id=184

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


&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if (file_exists($hist_path.$hist_file)) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im=imagecreatefromPNG($hist_path . $hist_file);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagePNG($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagedestroy($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; } else {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im=imagecreatefromjpeg($hist_path.$hist_image);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($i=0;$i<imagesx($im);$i+=2)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($j=0;$j<imagesy($im);$j++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $rrggbb=imagecolorsforindex ($im, imagecolorat($im,$i,$j));
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $r[$rrggbb['red']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $g[$rrggbb['green']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $b[$rrggbb['blue']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for ($i=0;$i<256;$i++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max[$i]=($r[$i]+$g[$i]+$b[$i])/3;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max_value=max($max)/150;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[0]=max($r);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[1]=max($b);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[2]=max($g);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max_rgb=max($m)/150;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im_out = imageCreate (280, 164);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $background = imageColorAllocate($im_out,70,70,70);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $hist=ImageColorAllocate($im_out,0,0,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $white=ImageColorAllocate($im_out,143,143,134);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $red=ImageColorAllocate($im_out,255,0,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $green=ImageColorAllocate($im_out,0,255,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $blue=ImageColorAllocate($im_out,0,0,255);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $ry=107;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $gy=107;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $by=107;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($i=0;$i<256;$i++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+14, 157, $i+14, 157-($max[$i]/$max_value),$white);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $ry, $i+14, 157-($r[$i]/$max_rgb), $red);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $gy, $i+14, 157-($g[$i]/$max_rgb), $green);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $by, $i+14, 157-($b[$i]/$max_rgb), $blue);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $ry=157-($r[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $gy=157-($g[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $by=157-($b[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,158,270,158,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,6,270,6,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,6,13,158,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,270,6,270,158,$hist);

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


details.php :
Code: [Select]
<?php
/**************************************************************************
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; 4images - A Web Based Image Gallery Management System&#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
 *&#160; &#160; ----------------------------------------------------------------&#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160;  File: details.php&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; Copyright: (C) 2002 Jan Sorgalla&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160; Email: jan@4homepages.de&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; Web: http://www.4homepages.de&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
 *&#160; &#160; Scriptversion: 1.7.6&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; Never released without support from: Nicky (http://www.nicky.net)&#160;  *
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 **************************************************************************
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-&#160; &#160; &#160;  *
 *&#160; &#160; bedingungen (Lizenz.txt) f&#252;r weitere Informationen.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
 *&#160; &#160; ---------------------------------------------------------------&#160; &#160;  *
 *&#160; &#160; This script is NOT freeware! Please read the Copyright Notice&#160; &#160; &#160;  *
 *&#160; &#160; (Licence.txt) for further information.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
 *************************************************************************/

$main_template 'details';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');
/*
&#160; MOD AJAX COMMENTS
&#160; BEGIN INSERT
*/
include(ROOT_PATH."ajaxcomments.php");
/*
&#160; MOD AJAX COMMENTS
&#160; END INSERT
*/
if (!$image_id) {
&
#160; &#160; redirect($url);
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
&
#160; foreach ($additional_image_fields as $key => $val) {
&#160; &#160; $additional_sql .= ", i.".$key;
&#160; }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
&#160; &#160; &#160; &#160; FROM ("
.IMAGES_TABLE." i,&#160; ".CATEGORIES_TABLE." c)
&#160; &#160; &#160; &#160; LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
&#160; &#160; &#160; &#160; WHERE i.image_id = 
$image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 0;

if (!
check_permission("auth_viewcat"$cat_id) || !check_permission("auth_viewimage"$cat_id) || !$image_row) {
&
#160; redirect($url);
}

$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image($cat_id);
$site_template->register_vars("random_cat_image"$random_cat_image);
unset(
$random_cat_image);

//-----------------------------------------------------
//--- 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");&#160; // Dateitypen f&#252;r die das Histogramm gezeigt werden soll

if (in_array($ext$AutorisedImageType)) {
 
$histogramm_image "<img src=\"histo.php?hist_image_id=".$image_row['image_id']."\" border=\"1\">"
} else {
&
#160;  $histogramm_image = REPLACE_EMPTY;
}

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

$image_allow_comments = (check_permission("auth_readcomment"$cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name format_text($image_row['image_name'], 2);
show_image($image_row$mode01);

$in_mode 0;

$sql "";
if (
$mode == "lightbox") {
&
#160; if (!empty($user_info['lightbox_image_ids'])) {
&#160; &#160; $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
&#160; &#160; $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
&#160; &#160; &#160; &#160; &#160; &#160; FROM ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; WHERE image_active = 1 AND image_id IN ($image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
&#160; &#160; &#160; &#160; &#160; &#160; ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
&#160; &#160; $in_mode = 1;
&#160; }
}
elseif (
$mode == "search") {
&
#160; if (!isset($session_info['searchid']) || empty($session_info['searchid'])) {
&#160; &#160; $session_info['search_id'] = $site_sess->get_session_var("search_id");
&#160; }

&#160; if (!empty($session_info['search_id'])) {
&#160; &#160; $search_id = unserialize($session_info['search_id']);
&#160; }

&#160; $sql_where_query = "";

&#160; if (!empty($search_id['image_ids'])) {
&#160; &#160; $sql_where_query .= "AND image_id IN (".$search_id['image_ids'].") ";
&#160; }

&#160; if (!empty($search_id['user_ids'])) {
&#160; &#160; $sql_where_query .= "AND user_id IN (".$search_id['user_ids'].") ";
&#160; }

&#160; if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
&#160; &#160; $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
&#160; &#160; $sql_where_query .= "AND image_date >= $new_cutoff ";
&#160; }

&#160; if (!empty($search_id['search_cat']) && $search_id['search_cat'] != 0) {
&#160; &#160; $cat_id_sql = 0;
&#160; &#160; if (check_permission("auth_viewcat", $search_id['search_cat'])) {
&#160; &#160; &#160; $sub_cat_ids = get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
&#160; &#160; &#160; $cat_id_sql .= ", ".$search_id['search_cat'];
&#160; &#160; &#160; if (!empty($sub_cat_ids[$search_id['search_cat']])) {
&#160; &#160; &#160; &#160; foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
&#160; &#160; &#160; &#160; &#160; if (check_permission("auth_viewcat", $val)) {
&#160; &#160; &#160; &#160; &#160; &#160; $cat_id_sql .= ", ".$val;
&#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; }
&#160; &#160; &#160; }
&#160; &#160; }
&#160; &#160; $cat_id_sql = $cat_id_sql !== 0 ? "AND cat_id IN ($cat_id_sql)" : "";
&#160; }
&#160; else {
&#160; &#160; $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
&#160; &#160; $cat_id_sql = $cat_id_sql !== 0 ? "AND cat_id NOT IN (".$cat_id_sql.")" : "";
&#160; }

&#160; if (!empty($sql_where_query)) {
&#160; &#160; $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
&#160; &#160; &#160; &#160; &#160; &#160; FROM ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; WHERE image_active = 1
&#160; &#160; &#160; &#160; &#160; &#160; $sql_where_query
&#160; &#160; &#160; &#160; &#160; &#160; $cat_id_sql
&#160; &#160; &#160; &#160; &#160; &#160; ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
&#160; &#160; $in_mode = 1;
&#160; }
}
if (!
$in_mode || empty($sql)) {
&
#160; $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
&#160; &#160; &#160; &#160; &#160; FROM ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; WHERE image_active = 1 AND cat_id = $cat_id
&#160; &#160; &#160; &#160; &#160; ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
}
$result $site_db->query($sql);

$image_id_cache = array();
$next_prev_cache = array();
$break 0;
$prev_id 0;
while(
$row $site_db->fetch_array($result)) {
&
#160; $image_id_cache[] = $row['image_id'];
&#160; $next_prev_cache[$row['image_id']] = $row;
&#160; if ($break) {
&#160; &#160; break;
&#160; }
&#160; if ($prev_id == $image_id) {
&#160; &#160; $break = 1;
&#160; }
&#160; $prev_id = $row['image_id'];
}
$site_db->free_result();

if (!
function_exists("array_search")) {
&
#160; function array_search($needle, $haystack) {
&#160; &#160; $match = false;
&#160; &#160; foreach ($haystack as $key => $value) {
&#160; &#160; &#160; if ($value == $needle) {
&#160; &#160; &#160; &#160; $match = $key;
&#160; &#160; &#160; }
&#160; &#160; }
&#160; &#160; return $match;
&#160; }
}

$act_key array_search($image_id$image_id_cache);
$next_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
$prev_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
unset(
$image_id_cache);

// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
&
#160; $next_image_name = format_text($next_prev_cache[$next_image_id]['image_name'], 2);
&#160; $next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));
&#160; if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $next_image_file = ICON_PATH."/404.gif";
&#160; }
&#160; else {
&#160; &#160; $next_image_file = get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
&#160; }
&#160; if (!get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $next_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
&#160; }
&#160; else {
&#160; &#160; $next_thumb_file = get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
&#160; }
}
else {
&
#160; $next_image_name = REPLACE_EMPTY;
&#160; $next_image_url = REPLACE_EMPTY;
&#160; $next_image_file = REPLACE_EMPTY;
&#160; $next_thumb_file = REPLACE_EMPTY;
}

if (!empty(
$next_prev_cache[$prev_image_id])) {
&
#160; $prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
&#160; $prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));
&#160; if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $prev_image_file = ICON_PATH."/404.gif";
&#160; }
&#160; else {
&#160; &#160; $prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
&#160; }
&#160; if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
&#160; }
&#160; else {
&#160; &#160; $prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
&#160; }
}
else {
&
#160; $prev_image_name = REPLACE_EMPTY;
&#160; $prev_image_url = REPLACE_EMPTY;
&#160; $prev_image_file = REPLACE_EMPTY;
&#160; $prev_thumb_file = REPLACE_EMPTY;
}

$site_template->register_vars(array(
&
#160; "next_image_id" => $next_image_id,
&#160; "next_image_name" => $next_image_name,
&#160; "next_image_url" => $next_image_url,
&#160; "next_image_file" => $next_image_file,
&#160; "next_thumb_file" => $next_thumb_file,
&#160; "prev_image_id" => $prev_image_id,
&#160; "prev_image_name" => $prev_image_name,
&#160; "prev_image_url" => $prev_image_url,
&#160; "prev_image_file" => $prev_image_file,
&#160; "prev_thumb_file" => $prev_thumb_file
));
unset(
$next_prev_cache);
/*--------------------------------------------- Start MOD: Photo Preview Hack ----------------------------------------- */
$result $site_db->query($sql);

while(
$row $site_db->fetch_array($result)){
&
#160; &#160; $image_preview[] = $row['image_id'];
&#160; &#160; $preview_row[$row['image_id']] = $row;
}
$lastPage count($image_preview);
$t_template "<table height=\"0\"width=\"600\"&#160; border=\"0\" cellspacing=\"5\" cellpadding=\"3\" align=\"center\"><tr>\n";
if(
$lastPage 6){
&
#160; &#160; $start = 0;
&#160; &#160; $end = $lastPage -1;
} elseif ($act_key == || $act_key == 1){
&
#160; &#160; $start = 0;
&#160; &#160; $end&#160;  = 4;
} elseif ($act_key == $lastPage-|| $act_key == $lastPage -2){
&
#160; &#160; $start = $lastPage - 5;
&#160; &#160; $end = $lastPage - 1;
} else {
&
#160; &#160; $start = $act_key -2;
&#160; &#160; $end&#160;  = $act_key +2;
}
$sizeTimes 0.5;
for(
$i=$start$i<=$end$i++){
&
#160; &#160; if ($preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
&#160; &#160; $t_template .= "<td style=\"border: 1px dashed #004C75; text-align:center; padding: .1cm \">\n";
&#160; &#160; } else {
&#160; &#160; $t_template .= "<td style=text-align:center; padding: .1cm\">\n";
&#160; &#160; }
&#160; &#160; $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
&#160; &#160; $oriWidth = substr($tag, strpos($tag, "width")+7, strpos($tag, "\" height")-strlen($tag));
&#160; &#160; $oriHeight = substr($tag, strpos($tag, "height")+8, strpos($tag, " alt")-strlen($tag)-1);
&#160; &#160; $tag = str_replace('width="'.$oriWidth.'"', 'width="'.$oriWidth*$sizeTimes.'"', $tag);
&#160; &#160; $tag = str_replace('height="'.$oriHeight.'"', 'height="'.$oriHeight*$sizeTimes.'"', $tag);
&#160; &#160; $t_template .= $tag."<br>\n";
&#160; &#160; $t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n";
}
$t_template .= "</td></table>\n";
$site_template->register_vars("preview_box"$t_template);
unset(
$image_preview);
/*--- End MOD: Photo Preview Hack&#160; ------------------------------------------ */
//-----------------------------------------------------
//--- Show Count Lightbox -----------------------------
//-----------------------------------------------------

$sql "SELECT COUNT(*) AS counter
&#160; &#160; &#160; &#160; FROM "
.LIGHTBOXES_TABLE."
&#160; &#160; &#160; &#160; WHERE lightbox_image_ids REGEXP '([^0-9]|^)"
.$image_row['image_id']."([^0-9]|$)'";
&
#160; &#160; &#160; &#160; 
$lightbox_count $site_db->query_firstrow($sql);

$site_template->register_vars(array(
&
#160; "lang_image_lightbox_count" => $lang['image_lightbox_count'],
&#160; "lightbox_count" => (isset($lightbox_count['counter']) && $lightbox_count['counter']) ? $lightbox_count['counter'] : 0
));

unset(
$lightbox_count);

//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error 0;
if (
$action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
&
#160; $id = intval($HTTP_POST_VARS[URL_ID]);
&#160; $sql = "SELECT cat_id, image_allow_comments
&#160; &#160; &#160; &#160; &#160; FROM ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; WHERE image_id = $id";
&#160; $row = $site_db->query_firstrow($sql);

&#160; if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
&#160; &#160; $msg = $lang['comments_deactivated'];
&#160; }
&#160; else {
&#160; &#160; $user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
&#160; &#160; $comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
&#160; &#160; $comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

&#160; &#160; $captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

&#160; &#160; // Flood Check
&#160; &#160; $sql = "SELECT comment_ip, comment_date
&#160; &#160; &#160; &#160; &#160; &#160; FROM ".COMMENTS_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; WHERE image_id = $id
&#160; &#160; &#160; &#160; &#160; &#160; ORDER BY comment_date DESC
&#160; &#160; &#160; &#160; &#160; &#160; LIMIT 1";
&#160; &#160; $spam_row = $site_db->query_firstrow($sql);
&#160; &#160; $spamtime = $spam_row['comment_date'] + 180;

&#160; &#160; if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)&#160; {
&#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
&#160; &#160; &#160; $error = 1;
&#160; &#160; }

&#160; &#160; $user_name_field = get_user_table_field("", "user_name");
&#160; &#160; if (!empty($user_name_field)) {
&#160; &#160; &#160; if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
&#160; &#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
&#160; &#160; &#160; &#160; $error = 1;
&#160; &#160; &#160; }
&#160; &#160; }
&#160; &#160; if ($user_name == "")&#160; {
&#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
&#160; &#160; &#160; $error = 1;
&#160; &#160; }
&#160; &#160; if ($comment_headline == "")&#160; {
&#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
&#160; &#160; &#160; $error = 1;
&#160; &#160; }
&#160; &#160; if ($comment_text == "")&#160; {
&#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
&#160; &#160; &#160; $error = 1;
&#160; &#160; }

&#160; &#160; if ($captcha_enable_comments && !captcha_validate($captcha)) {
&#160; &#160; &#160; $msg .= (($msg != "") ? "<br />" : "").$lang['captcha_required'];
&#160; &#160; &#160; $error = 1;
&#160; &#160; }

&#160; &#160; if (!$error)&#160; {
&#160; &#160; &#160; $sql = "INSERT INTO ".COMMENTS_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; &#160; (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; VALUES
&#160; &#160; &#160; &#160; &#160; &#160; &#160; ($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
&#160; &#160; &#160; $site_db->query($sql);
&#160; &#160; &#160; $commentid = $site_db->get_insert_id();
&#160; &#160; &#160; update_comment_count($id, $user_info['user_id']);
&#160; &#160; &#160; $msg = $lang['comment_success'];
&#160; &#160; }
&#160; }
&#160; unset($row);
&#160; unset($spam_row);
}

//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($image_allow_comments == 1) {
&
#160; $site_template->register_vars(array(
&#160; &#160; &#160; "has_rss"&#160;  => true,
&#160; &#160; &#160; "rss_title" => "RSS Feed: ".$image_name." (".str_replace(':', '', $lang['comments']).")",
&#160; &#160; &#160; "rss_url"&#160;  => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
&#160; ));

&#160; $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").", u.userpic


,
c.comment_rating,c.comment_votes,c.comment_rating_users
&#160; &#160; &#160; &#160; &#160; FROM ".COMMENTS_TABLE." c
&#160; &#160; &#160; &#160; &#160; LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
&#160; &#160; &#160; &#160; &#160; WHERE c.image_id = $image_id
&#160; &#160; &#160; &#160; &#160; 


ORDER BY c.comment_date ".(COMMENTS_ORDER ? "DESC" : "ASC")."";
&#160; 
$result = $site_db->query($sql);

&#160; 
$comment_row = array();
&#160; while (
$row = $site_db->fetch_array($result)) {
&#160; &#160; 
$comment_row[] = $row;
&#160; }
&#160; 
$site_db->free_result($result);
&#160; 
$num_comments = sizeof($comment_row);

&#160; if (!
$num_comments) {
&#160; &#160; 
$comments = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
&
#160; }
&#160; else {
&#160; &#160; $comments = "";
&#160; &#160; $bgcounter = 0;
&#160; &#160; for ($i = 0; $i < $num_comments; $i++) {
&#160; &#160; &#160; $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

&#160; &#160; &#160; $comment_user_email = "";
&#160; &#160; &#160; $comment_user_email_save = "";
&#160; &#160; &#160; $comment_user_mailform_link = "";
&#160; &#160; &#160; $comment_user_email_button = "";
&#160; &#160; &#160; $comment_user_homepage_button = "";
&#160; &#160; &#160; $comment_user_icq_button = "";
&#160; &#160; &#160; $comment_user_profile_button = "";
&#160; &#160; &#160; $comment_user_status_img = REPLACE_EMPTY;
&#160; &#160; &#160; $comment_user_name = format_text($comment_row[$i]['comment_user_name'], 2);
&#160; &#160; &#160; $comment_user_info = $lang['userlevel_guest'];

&#160; &#160; &#160; $comment_user_id = $comment_row[$i]['user_id'];
&#160; &#160; &#160; 
&#160; &#160; &#160; if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
&#160; &#160; &#160; &#160; $comment_user_name = format_text($comment_row[$i][$user_table_fields['user_name']], 2);

&#160; &#160; &#160; &#160; $comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$comment_user_id);
&#160; &#160; &#160; &#160; $comment_user_profile_button = "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";

&#160; &#160; &#160; &#160; $comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";

&#160; &#160; &#160; &#160; $comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
&#160; &#160; &#160; &#160; if (!empty($comment_user_homepage)) {
&#160; &#160; &#160; &#160; &#160; $comment_user_homepage_button = "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; $comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
&#160; &#160; &#160; &#160; if (!empty($comment_user_icq)) {
&#160; &#160; &#160; &#160; &#160; $comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
&#160; &#160; &#160; &#160; &#160; $comment_user_email = format_text($comment_row[$i][$user_table_fields['user_email']]);
&#160; &#160; &#160; &#160; &#160; $comment_user_email_save = format_text(str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]));
&#160; &#160; &#160; &#160; &#160; if (!empty($url_mailform)) {
&#160; &#160; &#160; &#160; &#160; &#160; $comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
&#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; else {
&#160; &#160; &#160; &#160; &#160; &#160; $comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
&#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; $comment_user_email_button = "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
&#160; &#160; &#160; &#160; &#160; $comment_user_info = $lang['userlevel_user'];
&#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
&#160; &#160; &#160; &#160; &#160; $comment_user_info = $lang['userlevel_admin'];
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; $comment_user_info .= "<br />";
&#160; &#160; &#160; &#160; $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
&#160; &#160; &#160; &#160; $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
&#160; &#160; &#160; }

&#160; &#160; &#160; $comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";

&#160; &#160; &#160; $admin_links = "";
&#160; &#160; &#160; if ($user_info['user_level'] == ADMIN) {
&#160; &#160; &#160; &#160; $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
&#160; &#160; &#160; &#160; $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
&#160; &#160; &#160; }
&#160; &#160; &#160; elseif ($is_image_owner) {
&#160; &#160; &#160; &#160; $admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
&#160; &#160; &#160; &#160; $admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
&#160; &#160; &#160; }

&#160; &#160; &#160; //--- Kommentar-Autor COUNTRY FLAGS ---
&#160; &#160; if (!class_exists("GeoIP"))
&#160; &#160; {
&#160; &#160; &#160; include(ROOT_PATH."includes/geoip.inc");
&#160; &#160; }
&#160; &#160; $gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
&#160; &#160; $countries = array();
&#160; &#160; $cid = geoip_country_code_by_addr($gi, $comment_row[$i]['comment_ip']);
&#160; &#160; if (empty($cid)) $cid = "lan";
&#160; &#160; $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
&#160; &#160; $comment_user_flag = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0>";
//--- Kommentar-Autor COUNTRY FLAGS ---

&#160; &#160; &#160; $site_template->register_vars(array(
&#160; &#160; &#160; &#160; "comment_id" => $comment_row[$i]['comment_id'],
&#160; &#160; &#160; &#160; "comment_user_flag" => $comment_user_flag,
&#160; &#160; &#160; &#160; "comment_user_id" => $comment_user_id,
&#160; &#160; &#160; &#160; "comment_user_status_img" => $comment_user_status_img,
&#160; &#160; &#160; &#160; "comment_user_name" => $comment_user_name,
&#160; &#160; &#160; &#160; "comment_user_info" => $comment_user_info,
&#160; &#160; &#160; &#160; "comment_user_profile_button" => $comment_user_profile_button,
&#160; &#160; &#160; &#160; "comment_user_email" => $comment_user_email,
&#160; &#160; &#160; &#160; "comment_user_email_save" => $comment_user_email_save,
&#160; &#160; &#160; &#160; "comment_user_mailform_link" => $comment_user_mailform_link,
&#160; &#160; &#160; &#160; "comment_user_email_button" => $comment_user_email_button,
&#160; &#160; &#160; &#160; "comment_user_homepage_button" => $comment_user_homepage_button,
&#160; &#160; &#160; &#160; "comment_user_icq_button" => $comment_user_icq_button,
&#160; &#160; &#160; &#160; "comment_user_ip" => $comment_user_ip,
&#160; &#160; &#160; &#160; "comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
&#160; &#160; &#160; &#160; "comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
&#160; &#160; &#160; &#160; "comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
&#160; &#160; &#160; &#160; "comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
&#160; &#160; &#160; &#160; "row_bg_number" => $row_bg_number,
&#160; &#160; &#160; &#160; "admin_links" => $admin_links
&#160; &#160; &#160; ));
&#160; &#160; &#160; /*
&#160; MOD AJAX COMMENTS
&#160; BEGIN INSERT
*/
&
#160; &#160; &#160; if (COMMENT_RATING_ANABLE)
&#160; &#160; &#160; {
&#160; &#160; &#160; &#160; $comment_row[$i]['cat_id'] = $cat_id;
&#160; &#160; &#160; &#160; $comment_row[$i]['image_allow_comments'] = $image_allow_comments;
&#160; &#160; &#160; &#160; comment_rating_template($comment_row[$i]);
&#160; &#160; &#160; }
/*
&#160; MOD AJAX COMMENTS
&#160; END INSERT
*/
&#160; &#160; &#160; $comments .= $site_template->parse_template("comment_bit");
&#160; &#160; } // end while
&#160; } //end else
&#160; /*
&#160; MOD AJAX COMMENTS
&#160; START REPLACE
*/
&
#160; $site_template->register_vars(array(
&#160; &#160; "comments" => $comments,
&#160; &#160; "comments_num" => $num_comments,
&#160; &#160; "commentbg" => (isset($row_bg_number)) ? $row_bg_number : 0,
&#160; &#160; "page" => $page,
&#160; &#160; "perpage" => $commentperpage,
&#160; ));

/*
&#160; MOD AJAX COMMENTS
&#160; END REPLACE
*/
&#160; unset($comments);

&#160; //-----------------------------------------------------
&#160; //--- BBCode & Form -----------------------------------
&#160; //-----------------------------------------------------
&#160; $allow_posting = check_permission("auth_postcomment", $cat_id);
&#160; $bbcode = "";
&#160; if ($config['bb_comments'] == 1 && $allow_posting) {
&#160; &#160; $site_template->register_vars(array(
&#160; &#160; &#160; "lang_bbcode" => $lang['bbcode'],
&#160; &#160; &#160; "lang_tag_prompt" => $lang['tag_prompt'],
&#160; &#160; &#160; "lang_link_text_prompt" => $lang['link_text_prompt'],
&#160; &#160; &#160; "lang_link_url_prompt" => $lang['link_url_prompt'],
&#160; &#160; &#160; "lang_link_email_prompt" => $lang['link_email_prompt'],
&#160; &#160; &#160; "lang_list_type_prompt" => $lang['list_type_prompt'],
&#160; &#160; &#160; "lang_list_item_prompt" => $lang['list_item_prompt']
&#160; &#160; ));
&#160; &#160; $bbcode = $site_template->parse_template("bbcode");
&#160; }

&#160; if (!$allow_posting) {
&#160; &#160; $comment_form = "";
&#160; }
&#160; else {
&#160; &#160; $user_name = (isset($HTTP_POST_VARS['user_name']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['user_name'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
&#160; &#160; $comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
&#160; &#160; $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

&#160; &#160; $site_template->register_vars(array(
&#160; &#160; &#160; "bbcode" => $bbcode,
&#160; &#160; &#160; "user_name" => $user_name,
&#160; &#160; &#160; "comment_headline" => $comment_headline,
&#160; &#160; &#160; "comment_text" => $comment_text,
&#160; &#160; &#160; "lang_post_comment" => $lang['post_comment'],
&#160; &#160; &#160; "lang_name" => $lang['name'],
&#160; &#160; &#160; "lang_headline" => $lang['headline'],
&#160; &#160; &#160; "lang_comment" => $lang['comment'],
&#160; &#160; &#160; "lang_captcha" => $lang['captcha'],
&#160; &#160; &#160; "lang_captcha_desc" => $lang['captcha_desc'],
&#160; &#160; &#160; "captcha_comments" => (bool)$captcha_enable_comments
&#160; &#160; ));
&#160; &#160; $comment_form = $site_template->parse_template("comment_form");
&#160; }
&#160; $site_template->register_vars("comment_form", $comment_form);
&#160; unset($comment_form);
// end if allow_comments

// Admin Links
$admin_links "";
if (
$user_info['user_level'] == ADMIN) {
&
#160; $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
&#160; $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif (
$is_image_owner) {
&
#160; $admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
&#160; $admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
}
$site_template->register_vars("admin_links"$admin_links);

// Update Hits
if ($user_info['user_level'] != ADMIN) {
&
#160; $sql = "UPDATE ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; SET image_hits = image_hits + 1
&#160; &#160; &#160; &#160; &#160; WHERE image_id = $image_id";
&#160; $site_db->query($sql);
}

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if (
$mode == "lightbox" && $in_mode) {
&
#160; $page_url = "";
 
if (preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
&
#160; &#160; if (!empty($regs[1]) && $regs[1] != 1) {
&#160; &#160; &#160; $page_url = "?".URL_PAGE."=".$regs[1];
&#160; &#160; }
&#160; }
&#160; $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
}
elseif (
$mode == "search" && $in_mode) {
&
#160; $page_url = "";
&#160; if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
&#160; &#160; if (!empty($regs[1]) && $regs[1] != 1) {
&#160; &#160; &#160; $page_url = "&amp;".URL_PAGE."=".$regs[1];
&#160; &#160; }
&#160; }
&#160; $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
&
#160; $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $image_name."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
&
#160; "msg" => $msg,
&#160; "clickstream" => $clickstream,
&#160; "lang_category" => $lang['category'],
&#160; "lang_added_by" => $lang['added_by'],
&#160; "lang_description" => $lang['description'],
&#160; "lang_keywords" => $lang['keywords'],
&#160; "lang_date" => $lang['date'],
&#160; "lang_hits" => $lang['hits'],
&#160; "lang_downloads" => $lang['downloads'],
&#160; "lang_rating" => $lang['rating'],
&#160; "lang_votes" => $lang['votes'],
&#160; "lang_author" => $lang['author'],
&#160; "lang_comment" => $lang['comment'],
&#160; "lang_prev_image" => $lang['prev_image'],
&#160; "lang_next_image" => $lang['next_image'],
&#160; "lang_file_size" => $lang['file_size']
));

$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 10, 2009, 10:31:19 AM
continuing from previous post


I have created the data/histo directory
I have uploaded the background.php file to the root directory

I get a broken image.... if I try to view the broken image I get a ton of errors pages long. I think this is a cool mod if anyone has =any idea....

Title: Re: [MOD] Histogram
Post by: mawenzi on March 10, 2009, 10:48:07 AM
hey Robert ...

... there is something wrong with your php-editor or something else ...
... try the code download for histogramm.php (not histo.php) and details.php again ... and use another php-editor ...
... you are the first downloader who presented such a code after downloading ... ;)
... and please use for reading the installation instruction : Google-Translator ...
...
... your problems have nothing to do with version 1.7.6 and using php5 ...

... edit ...
... and please read this here (http://209.85.135.132/translate_c?hl=de&sl=de&tl=en&u=http://www.4homepages.de/forum/index.php%3FPHPSESSID%3Da0fe4d13d31323321c86cad7d2fc6a1a%26topic%3D11844.msg126008&usg=ALkJrhjlX-_l2cvBcJjcDCJbeoVAUe17dw#msg126008) ...
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 10, 2009, 05:29:11 PM
Wow... dont know where those characters came from.. I use ultraedit... weird I think that was a forum error ... my files dont look like that . sorry...


I lived in Brotterode Thuringen for many years... So my German is not that bad.... Aber ich haub keine lust fur schreiben ich weisse meine deutsche ich sehr schreklische und hwssiliche und unbekkant. Naja///

So you see it is cool when I read German and speaking it probably sounds funny enough... but I still think it is better than my Chinese :) THAnk god 4images is  not Chinese as I cant read it at all even after 8 years...

ANyways the problem I made was I created the directory in the wrong directory. I was confused as you have support in the forum on your download page, and people replying to the original thread on this page/// It seems like they are replying to the original threads modifications and not to the modifications made to the version on your site. SO I was not sure what was up and tried to follow through using the original one in the thread.....


I think you shouls put the changes in the mod from your forum onto this one so people could follow the changes and know which is the one to troubleshoot. Right now it is like two different mods in one thread.. or two threads in two forums...  8O
Title: Re: [MOD] Histogram
Post by: mawenzi on March 11, 2009, 09:56:13 AM
@ AntiNSA2

... I saw ... the histogram is installed ... with german discription ... ;)
... almost perfect ...
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 11, 2009, 10:04:50 AM
Ah German , english... its all the same : ) the people that read histogram need no translations :) If I get time (Really bigt if always busy) Ill put the stuff up here in English :)
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 11, 2009, 10:05:45 AM
BTW thanks cool mod.. I wanted to sak... do you know how much externally added before 4images watermarks alter the histogram?
Title: Re: [MOD] Histogram
Post by: AntiNSA2 on March 28, 2009, 07:00:46 PM
I am coming back to this great working mod, and have read through the thread again... but couldnt find how to resize the histogram? I think it is way to big....


Where are the settings?

THanks! (4 all the great mods)
Title: Re: [MOD] Histogram
Post by: d1eter on February 04, 2010, 10:14:44 AM
I believe I have followed all the steps correctly..,
yet the histogram is not showing.
in here (http://batamphotoclub.org/gallery)

please help
thank you!
Title: Re: [MOD] Histogram
Post by: d1eter on February 08, 2010, 10:25:51 AM
anyone..?
 :cry:
Title: Re: [MOD] Histogram
Post by: mawenzi on February 08, 2010, 11:24:22 AM
I believe I have followed all the steps correctly..,

... you're certain ... ? ... and also this ... ?

@all
... I redesigned this MOD with some fixes ...
... you can download all neccesary files and the installations instruction ... here (http://klick.kl.funpic.de/files.php) ...
Title: Re: [MOD] Histogram
Post by: d1eter on February 09, 2010, 05:21:23 AM

... you're certain ... ? ... and also this ... ?

@all
... I redesigned this MOD with some fixes ...
... you can download all neccesary files and the installations instruction ... here (http://klick.kl.funpic.de/files.php) ...

I've checked and re-checked several times.. following the guidance from this thread.

the Histogram MOD in the link you provided is not downloadable.. it says OFF

thanx!
Title: Re: [MOD] Histogram
Post by: mawenzi on February 09, 2010, 03:38:25 PM
... sorry to read, that you are not be able to get this ON ...
Title: Re: [MOD] Histogram
Post by: V@no on February 10, 2010, 12:24:38 AM
the Histogram MOD in the link you provided is not downloadable.. it says OFF

thanx!
The file available for registered members only. Register then you can download the package.

@mawenzi:
I don't know if you aware of this, but if you add id=NN in the url it will display correct page and highlight the file with that id?
http://klick.kl.funpic.de/files.php?id=29
Title: Re: [MOD] Histogram
Post by: d1eter on February 10, 2010, 02:09:16 AM
The file available for registered members only. Register then you can download the package.


thank you for the explanation V@no.., I wouldn't know..  :lol:
seeing a foreign language confused me already....

I'll try to register..
hopefully I don't get lost..   :lol:


oops.. registration failed, cannot register...
 :(
Title: Re: [MOD] Histogram
Post by: mawenzi on February 10, 2010, 04:46:42 PM
@ d1eter ...
... there can't be a failed registration ...
... for some time you don't need a mail for register on my website ...
... the text in the red box is only a hint for that ...
... after registering you can directly logged in with your name and password on my site ... it's that simple ...

@V@no ...
... yes, the link in this manner is perfect ...  :mrgreen:
... I'll edit my first post in this way ...
Title: Re: [MOD] Histogram
Post by: mawenzi on February 17, 2010, 01:12:09 PM
@ d1eter ...
... I just saw the perfect working histogram incl. a histogram-info translation in english on your website ...
... looks very nice ...

@ AntiNSA2 ...
... for a smaller histogram-design you can use the attributes "width" and "hight" for the histo-image to your needs ...
Title: Re: [MOD] Histogram
Post by: d1eter on February 18, 2010, 02:38:32 AM
@ d1eter ...
... I just saw the perfect working histogram incl. a histogram-info translation in english on your website ...
... looks very nice ...

yes mawenzi...,
couldn't have done it without your perfectly working script...   :wink:
thank you!

the background gif still in german though...   :oops:
Title: Re: [MOD] Histogram
Post by: mawenzi on February 18, 2010, 09:43:08 AM
@d1eter ...

... so you need a background.gif in ... english ... ?
Title: Re: [MOD] Histogram
Post by: d1eter on February 19, 2010, 07:14:01 AM
that'll look nice.. isn't it..
 :P
Title: Re: [MOD] Histogram
Post by: uli480 on July 12, 2010, 11:36:40 AM
Where can i download this modification?
the links from the original posting are down
Title: Re: [MOD] Histogram
Post by: mawenzi on July 12, 2010, 01:00:20 PM
@ uli480

... sorry ... but my server is down at time ...
... try to download in some days ...
... and if you can see the histogram-image in the original-post, then you can download the modification from my website ...

Edit ...
... the download and the tutorial are now again available from my website ...
Title: Re: [MOD] Histogram
Post by: uli480 on July 20, 2010, 08:45:22 AM
the server is still down. can you please upload it in the forum? thx :-)
Title: Re: [MOD] Histogram
Post by: lostdragon on August 16, 2010, 11:40:51 AM
The server prompts you to enter a verification code when entering the code says that is not true. Put in another place. Thanks.
Title: Re: [MOD] Histogram
Post by: bma2004 on August 25, 2011, 11:05:54 PM
What is needed php library for the normal functioning of MOD?
Title: Re: [MOD] Histogram
Post by: senloel on December 26, 2013, 12:33:01 PM
Does anyone has this file as you aren't able to download it any more?

Thank you!

Regards,
Patrick
Title: Re: [MOD] Histogram
Post by: senloel on December 31, 2013, 12:51:15 PM
Does anyone has this file as you aren't able to download it any more?

Thank you!

Regards,
Patrick

nobody?