flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin

Started by loungelizard, January 26, 2010, 10:35:22 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

loungelizard

I've played around with Coppermine a while and implemented two functions I liked from Pixelpost-Addons I've tried out before.
The Plugin serves two purposes:
- provide Geotag support for Coppermine
- provide histogram suppport for Coppermine

Geotag support:
Upon installation a new table is generated into the coppermine schema. This table holds all the EXIF data from
images it can find. Right now, I'm extracting more data than I use for the geotagging feature. I don't know
yet what to do with them in the future ;-)
The EXIF-Data are pulled from images upon upload. If you want to generate the EXIFs from all the existing
images in your database, a special function is nested inside the Plugin-Manager page.
Upon displaying of an image, it is checked, whether Geotag-Data is inside the plugin's table. If the
required Geodata exists, an icon is displayed that can be clicked to open the location in a
Google Maps view. If no Geodata is available, you can choose to hide the image or display an image without
a link.

Histogram support
If activated a histogram is created upon upload of an image. The settings are fully configurable.
All histograms are stored in the original file directory and have a filename
   hist_<coppermine_id><original filename>.jpg
Histograms can be generated upon upload of new images or on demand, in case someone clicks on the corresponding button.

Please try the plugin out and give me feedback. I know it's not completely ready so please, if you encounter any problems,  leave a post in this thread and I'll look into it.

Be sure to read the readme for full details regarding configuration.

Regards, Florian

==============================================================================================================
Credits
==============================================================================================================
- This plugin for Coppermine was inspired and is in part based upon "easyMap for Pixelpost" by http://maximee.de
- Credits to Doug Pillow for the geodata conversion algorithm http://www.weberdev.com/get_example-3548.html
- Credits to eenemeenemuu for his fav_button Plugin that showed me how to add buttons to the navbar
- The function to generate the histograms was adapted from the Pixelpost addon by Kevin Crafts http://blog.kevincrafts.com/
- The configuration screen uses the farbtastic color picker by Steven Wittens http://acko.net/dev/farbtastic

==============================================================================================================

v1.9  - Fixed a bug that caused not to show geobutton, if geo-coordinates showed a zero value.
v1.8  - Fixed the bug that geotags were not extracted when using the watermarking feature. This only
         works, if the original image is residing in the same folder as the watermarked image.
v1.7   - changed the way displaymap was called for the Google maps to make it  similar to the albumview
       - Fixed a bug in the config menu regarding a the new parameter.
       - Fixed the nasty bug that caused the problems with the swf-uploader. SWF Upload works fine again  when my plugins are installed :-)

Joachim Müller

Thanks for your readiness to share. Well done for your first plugin, I'm really impressed.
There already is a plugin that generates histograms - see EnlargeIt! AJAX GUI for CPG 1.5.x; I don't think that it's a good idea to create a load of files within one folder. This will no doubt crash bigger galleries, especially since the histogram is created in one big bulk. I find your histogram much more beautifull though than the one I refered to.

I have reviewed your plugin and changed some things (for coppermine coding guidelines compliance). Please don't get me wrong: your plugin is great and much appreciated. I'm posting this for the benefit of plugin authors:

Once again, thanks for your contribution.
Is it OK to add your plugin to the subversion repository?

Joachim

Timos-Welt

Hi Florian,

thanks a lot for sharing your new plugin!

Why did you implement Lytebox additionally, as we already have greybox integrated in Coppermine (to display the help system)? Should be equal in function, avoids another javascript to be loaded, and would keep the look and feel.

loungelizard

Hi Timo,
thanks for the info and yes, you're right, I should try to avoid putting additional things in it. I'll look into dropping lytebox and changing it to greybox in a future version.

Regards, Florian

loungelizard

Hi Joachim and thanks for your hints. Please do add the files to the repository, I'll start working from there as soon as I can, I may need some pointers on how to set everything up but I believe in the strength of the community to get this all done even better.

Regarding the histogram function: I plan on changing it to an on-demand-generation, so that the histogram is only generated if you really want one, so only the first person to click on the link has to wait while the histogram is being generated. Do you have a better idea in mind, what to do?
The credits for the histogram goes to Kevin Craft and his fine work for the Pixelpost addon. I merely adapted it to Coppermine.

I'll look into the changes you suggested as soon as I get the chance. - I didn't get the remark about the config file though, can you rephrase?

Regards, Florian


Joachim Müller

#5
Quote from: loungelizard on January 27, 2010, 11:40:17 PMPlease do add the files to the repository
Great, thank you. I have added the plugin to the svn repository. Web SVN access: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/flf_histotag/

Quote from: loungelizard on January 27, 2010, 11:40:17 PMRegarding the histogram function: I plan on changing it to an on-demand-generation, so that the histogram is only generated if you really want one, so only the first person to click on the link has to wait while the histogram is being generated. Do you have a better idea in mind, what to do?
That's exactly the mechanism I had in mind and how I implemented this for the enlargeIt plugin: in an early version, the histgoram used to be created in a sub-folder of the plugin. This is of course not a good solution: all files related to the content should reside inside the albums folder. That's why the histogram files created by the enlargeit plugin get created in the very folder where the original files reside in; they just get prefixed accordingly. I suggest to use a slightly different prefix name for your plugin. When a histogram file is needed, the plugin checks if that file already exists and creates it if it doesn't. Additionally, I have come up with a nifty cache control for those who are short on web space: you can control the amount of webspace that the histogram files are allowed to consume in total. I'm not sure if this feature will be actuall used a lot (I doubt it), as the histogram files don't eat much space in the first place, so I basically implemented it as a proof-of-concept.

Quote from: loungelizard on January 27, 2010, 11:40:17 PMI didn't get the remark about the config file though, can you rephrase?
You appear to have based the way you coded the plugin configuration screen on a plugin where this has not been done in an ideal way - that's why your plugin's config section differs very much from the look of what I would call an ideal config screen. We have written down some remarks on the usability of forms inside the docs: http://documentation.coppermine-gallery.net/en/dev_coding.htm#dev_coding_usability_forms
Plugin writers are encouraged to review that section carefully. If you want to get an impression of what we consider to be a good config screen in terms of usability, take a look at the thumb_rotate plugin or the enlargeit plugin (screenshots attached). Anyway, what I really suggested was that I would take care of that config screen (if you agree) and have that "pimped" in the way I pimped the config screen of the other two plugins.

I have added your plugin to our download section at sourceforge as well: http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_flf-histotag_v1.0.zip/download

Cheers

loungelizard

Quote from: Joachim Müller on January 28, 2010, 07:57:30 AM
Great, thank you. I have added the plugin to the svn repository. Web SVN access: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/flf_histotag/

How do I get write access to the svn? My sourceforge id is loungelizard99. Or do you only grant write access to the core team; if so: How do I submit changes?

Quote from: Joachim Müller on January 28, 2010, 07:57:30 AM
Anyway, what I really suggested was that I would take care of that config screen (if you agree) and have that "pimped" in the way I pimped the config screen of the other two plugins.

Thanks for that offer, I'd appreciate your help. I'm already in the process of changing some of my files so if you can avoid changes to any of the files but the configuration screen, I don't get confused when putting it all together.


Regards,
Florian

Joachim Müller

Quote from: loungelizard on January 28, 2010, 03:59:20 PM
How do I get write access to the svn? My sourceforge id is loungelizard99. Or do you only grant write access to the core team; if so: How do I submit changes?
You already anticipated it: we only grant write access for dev team members. Just check out the subversion repository, perform your changes, then zip the plugin and re-attach it here - a dev team member will commit your changes in the zip file for you. This usually happens within a few hours after posting, as there are several active devs who perform that task.

Quote from: loungelizard on January 28, 2010, 03:59:20 PMThanks for that offer, I'd appreciate your help. I'm already in the process of changing some of my files so if you can avoid changes to any of the files but the configuration screen, I don't get confused when putting it all together.
OK, great - I'll let you know about my changes.

loungelizard

Hi,
I'm in the process of putting in the changes as discussed above. Now I'm stuck with one problem which I'm sure you Coppermine-Gurus know the solution quickly to.

To generate the histograms on demand, i changed the mechanism from displaying an image with the histogram (which at that time had to be generated) to displaying a new php-page residing in my plugin folder called histotag_histogram_display.php which i pass the picture ID parameter to.

When opened, I want to check if the histogram-image exists, and if it doesn't (and configuration is set to do so) generate the histogram on the fly and then displaying it in the html output.

All auxiliary functions are inside include/histotag_histogram_support.php.
The problem I'm having now is that obviously this file .._display.php runs outside the coppermine focus so I don't have access to the required core functions.
I tried to resolve this by putting in
define('IN_COPPERMINE', true);
require('../../include/init.inc.php');
require ("include/histotag_histogram_support.php");

in that file, but with those relative paths the includes inside init.inc.php fail, cause they go from the coppermine-root-directory.

What do I have to do to set the context right, so I can include the init.inc as well as other files from an auxiliary page that resides inside my plugin folder?

Regards, Florian

Αndré

Just call the script with index.php?file=flf_histotag/histotag_histogram_display instead of calling it with ./flf_histotag/histotag_histogram_display.php.

loungelizard

Hi André and thanks for your quick response. I get the page started this way, thank you. However, now I have the problem of needing to transfer information to the new .php-file, the Picture-ID in particular. I don't seem to be able to pass it with a regular parameter, cause the index.php strips those away and the $CURRENT_PIC_DATA-array is empty inside my newly opened file (I did include it with GLOBAL). 
Do you have another pointer for me as to how to get a value passed to my file?
Regards, Florian

loungelizard

solved it by using the $_SESSION-array until I find something better. Now I just have to clean up some code fragments so I can release the updated plugin later today.

loungelizard

Version 1.1 released.
Major changes:

  • Renamed files according to coding conventions
  • Changed Tablename according to naming conventions
  • Removed lytebox for displaying pictures, substituted with greybox - thanks to 'TimosWelt' for the hint
  • Histograms are now being generated on demand only when the histogram button is clicked. This way the system doesn't get cluttered with histograms that noone is interested in seeing. Downside: first time to call the histogram takes some time.
  • Changed Histogram quality to 75% to get smaller filesizes

Please see readme on instructions how to upgrade.

Cheers, Florian

Αndré

Committed changes in r7165.


Quote from: Joachim Müller on January 27, 2010, 09:11:04 AM
  • The zip archive needs to contain the folder, as newbies will not understand that they have to put all plugin files into a name with a particular folder that can not be changed

Timos-Welt

I get an SQL error when trying to "Generate all histograms (DANGER!)":

While executing query 'SELECT t.pid, t.filepath, t.filename FROM cpg15x_pictures t WHERE t.pid not in (SELECT pid from  cpg15x_ );' in plugins/flf_histotag/include/histotag_histogram_support.php on line 192

mySQL error: Table 'db166218_7.cpg15x_' doesn't exist


and I get another SQL error when trying to "Gather exif from all files!"

While executing query 'INSERT into cpg15x_plugin_flf_histotag VALUES ('21','','','','','','','','','','','','','','','','','','','','','','','','','','','',,'','','','','','')' in plugins/flf_histotag/include/histotag_support.php on line 143

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''','','','','','')' at line 1

loungelizard

Fixed the one in the generate histogram function (missed one string replacement). The other one seems to be related to the specific file that you have in your database. Can you provide me with the original file that corresponds to your ID #21? I've seen this error on one of my images before, too but I can't find the file anymore ;) It's working fine on my testbed and live system.
Thanks.
Cheers, Florian

Timos-Welt

The file is here:
http://pics.timos-welt.de/displayimage-21.html

Have a look at the filename, I assume it's the ( and ) that breaks it.

loungelizard

No, it must be something that resides inside the exif information; double checked it to be sure. I don't use the filename for anything related to that part. Can you give me access to the original file?


loungelizard