Histogram plugin ready

I managed to get a working plugin that creates a histogram form the image that is been shown. I got the idea from a Pixelpost plugin called RGBhistogram, actually the calculations are from this plugin. I just molded it to work with Zenphoto.

For who is interested, it can be downloaded here:
http://www.marcelspijker.nl/marcel/zenphoto/?p=links

One bad thing! I still have to make it so that the histogram files are also in subfolders. Have no idea how to do, so any ideas are welcome.

Comments

  • acrylian Administrator, Developer
    A link has been added on our zenphoto plugins page.
  • Nice plugin. Some comments:

    The plugin does not create the folder for the histograms. You should add
    `$folder = SERVERPATH.'/'.getOption('hist_Folder').'/';

    if (!file_exists($folder)) {

    @mkdir($folder, CHMOD_VALUE);

    }`
    to the bottom of the script.

    The Zenphoto convention is that functions that begin with `print` actually place the output on the page. Functions that start with `get` return something that the theme can then place on the page. Your `printHistogram()` should either be `getHistorgram()` or it should echo the results.

    I think that implementing the subfolders is pretty important. You may get image name collisions otherwise.

    Of course, eventually the in-line text needs to be changed to English (where it is not) and enclosed in `gettext()` calls.
  • acrylian Administrator, Developer
    Also you could consider simply adding the album name to the image file names to avoild name conflicts (for example albumname_imagename.jpg).
  • As a suggestion, you could use the same cache folder that the resized and thumbnail images use.
  • Thanks for the replays! I will update the plugin as soon as possible and let it know here.
  • I put up a new version of the histogram plugin.
    It has a lot of code cleaning inc the gettext() for all of the text.
    Also it makes sub folders where it stores the histogram file.
    You can download the new version > http://www.marcelspijker.nl/marcel/zenphoto/?p=links/

    I have some new ideas to add, like a button in admin panel to clean up the histogram files that are no longer used, and maybe an option with every image to set view/no-view for the histogram file, don't yet know how to do such a thing, bit i will try :)
    Also i don't know how to handle the image/album move options that are now in v1.2 of zenphoto. Would really like to see that the histogram files would also be moved then...

    So as you can see i have lots of ideas, but non how to create it, so it is a nice learning project for me :)

    All input is welcome, and again thanks for the great input!
  • The button in your options is not too hard, just use the custom handling type. You would not be able to add an option for each image without modifying the zp core. So, it depends on how important it is to decide by image about the histogram. Maybe if you just include hiding/showing the histogram in the plugin that would be good enough.
  • code Member
    I just updated to 1.2 and downloaded the plugin...

    I got this error

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3888 bytes) in /home/myusername/public_html/zp-core/plugins/histogram.php on line 116
  • Your PHP memory is set to low. You'll need to change "memory_limit" in your php.ini file to a larger value.
  • code Member
    thanks!
Sign In or Register to comment.