• [MOD] Histogram 4 0 5 1
Currently:  

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

0 Members and 1 Guest are viewing this topic.

Offline cappuccino

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • PIXXGALLERY
Re: [MOD-REQ] Histogram
« Reply #45 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ß

Offline Chicco

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • The Picture World
Re: [MOD-REQ] Histogram
« Reply #46 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?


Wissen ist MACHT! Nix zu wissen macht aber auch nix! ;-)

Gruß
Ch¿cco

Offline Chicco

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • The Picture World
Re: [MOD-REQ] Histogram
« Reply #47 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....


Wissen ist MACHT! Nix zu wissen macht aber auch nix! ;-)

Gruß
Ch¿cco

Offline cappuccino

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • PIXXGALLERY
Re: [MOD-REQ] Histogram
« Reply #48 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ß

Offline cappuccino

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • PIXXGALLERY
Re: [MOD-REQ] Histogram
« Reply #49 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

Offline Chicco

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • The Picture World
Re: [MOD-REQ] Histogram
« Reply #50 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... :?


Wissen ist MACHT! Nix zu wissen macht aber auch nix! ;-)

Gruß
Ch¿cco

Offline cappuccino

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • PIXXGALLERY
Re: [MOD-REQ] Histogram
« Reply #51 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

*User*

  • Guest
Re: [MOD-REQ] Histogram
« Reply #52 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

Offline wallpapers

  • Full Member
  • ***
  • Posts: 107
    • View Profile
    • Tuned-Cars.Net
Re: [req mod] histogram
« Reply #53 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:



Offline wallpapers

  • Full Member
  • ***
  • Posts: 107
    • View Profile
    • Tuned-Cars.Net
Re: [MOD-REQ] Histogram
« Reply #54 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:



Offline Tomi

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [MOD-REQ] Histogram
« Reply #55 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..

Offline qwertz

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • haaseart
Re: [MOD-REQ] Histogram
« Reply #56 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:

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD-REQ] Histogram
« Reply #57 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
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

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

Offline qwertz

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • haaseart
Re: [MOD-REQ] Histogram
« Reply #58 on: April 27, 2006, 11:42:47 PM »
danke schön!!!  :D werde ich gleich ändern!

Offline Chicco

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • The Picture World
Re: [MOD] Histogram
« Reply #59 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.


Wissen ist MACHT! Nix zu wissen macht aber auch nix! ;-)

Gruß
Ch¿cco