EXIF UserComment plugin EXIF UserComment 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

EXIF UserComment plugin

Started by JohanLundin, March 16, 2006, 06:00:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JohanLundin

Just wrote up a quick and dirty plugin to extract the EXIF UserComment field from JPG pictures and display it in Coppermine as title/caption.

A few related URLs:

Description and download of plugin:
http://www.bluenine.se/products/photocomment/coppermineplugin.html

An EXIF UserComment editor:
http://www.bluenine.se/products/photocomment/

The plugin in action:
http://www.tacticaldiving.com/cpg/index.php

Any possibility to change the require to require_once in exif_php.inc.php for next release?
Would simplify the installation of this plug-in and won't break anything else.


[Edit GauGau 2010-03-05]
This plugin has been added to the subversion repository: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.4.x/plugins/

It has been updated as well to reflect the version checking routines in the plugin manager that are meant to make sure that galleries don't break because of plugins installed that aren't meant for that particular version of the gallery.

Download: https://sourceforge.net/projects/coppermine/files/Plugins/1.4.x/cpg1.4.x_plugin_photocomment_v1.1.zip/download
[/Edit]

Joachim Müller

#1
Thanks for your contribution. Here's the instructions from your page and the plugin zip file (in case your server goes down):
QuotePhotoComment Coppermine plugin
- Displays your comment as image description in Coppermine

PhotoComment is by default configured to read and save comments for JPG pictures using the EXIF UserComment field. When publishing your photos online you may want to display these comments together with the pictures.

Coppermine is one of the better free open source photo album software packages available. The reason Coppermine was chosen to work with PhotoComment was:

   * Coppermine works reasonable well in PHP SafeMode which most PHP ISP offers
   * Coppermine is the most advanced photo album that still satisfies the previous condition
   * Coppermine has a plugin architecture making modifications easy

To install the PhotoComment Coppermine plugin follow these steps:

  1. Install Coppermine
  2. Download the plugin
  3. Unzip the plugin file and upload to server to create the following file structure
     <coppermine_root>/plugins/PhotoComment
     containing the files codebase.php and configuration.php
  4. Edit the file <coppermine_root>/include/exif_php.inc.php and change the line
     require("include/exif.php");
     to
     require_once("include/exif.php");
  5. Install the plugin from the Coppermine admin interface

 

Mats

For Coppermine 1.48: Is this plug-in still needed, or is it built-in?

Paver

@Mats: Coppermine 1.4.8, as the announcement thread says, has no new features.  It only contains bug fixes and the important security fix and stability fix mentioned.

New features will be considered for the next major release which is 1.5.

Mats

#4
Yeah, just noticed. Thanks for the reply :)

Still got one problem with this though, and that is that comments with accented characters get scrambled.

Example:
Utsikt fr宠v岠hotellterass

Should be:
Utsikt från vår hotellterass

Running CPG 1.48 (with Unicode UTF-8) on Win2003 srv SP1, PHP 5.14 in ISAPI mode, MySQL 5.0.21 (Def. char set: latin1). This is a general problem though. Have the same in other plug-ins which I've translated into Swedish.

I haven't touched the CPG *.php files, and I've also tried updating php.ini's default_charset to: default_charset = "UTF-8"

Strange thing is that CPG is fine, but after having added text to the EXIF UserComment field (done on a Swedish WinXP Pro SP2) and uploaded the two test images, they showed up like this:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.home.no%2Fmasken%2Fpics%2Fcpg_error_usercomment_plug-in.JPG&hash=fbd0db8f728ff201b9f4a983d1e05a550850dc76)

Anyone with a clue?

Mats

The page header (view > source) also shows UTF-8:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Mats


Joachim Müller


Mats

uhm...? I didn't ask for your reply specifically. I bounced the message, that's all. Since this is a very active forum, there's a risk there will be no reply if it drops to te second page - and I did that after a whole day. Nothing to fuzz about if you ask me...

Nibbler

> maybe nobody knows the answer to your problem

Mods come as-is, you can't demand support for them.

rjbearcan

Every time I go to install this plug in, I get a "There was an error while processing a database query" error, any ideas on what the problem is?

Joachim Müller

Enable debug_mode in coppermine's config, then install the plugin, then copy the actual error message (the actual query that fails, not the debug_output) into your posting here. Additionally, do as suggested per board rules.

rjbearcan

I enabled the debug mode and found that it was already listed in the database as being installed even though it wasn't showing in the installed plugins on the page.

mykee

Quote from: Paver on June 12, 2006, 01:59:33 PM
@Mats: Coppermine 1.4.8, as the announcement thread says, has no new features.  It only contains bug fixes and the important security fix and stability fix mentioned.

New features will be considered for the next major release which is 1.5.
I search this function in 1.5 version under EXIF manager, but not found...  :( Need a new plugin again?
My gallery and demo for AnythingSlider, Photocols and CollagePlus plugin: http://foto.acegem.hu/index.php

Joachim Müller

Stop misbehaving. You're not allowed to post request for version ports, i.e. you mustn't ask to have plugins or mods designed for cpg1.4.x to be ported to cpg1.5.x. Additionally, I don't like the attitude behind your postings - between the lines, your posting reads "Why has this feature that I deem to be important not been integrated into cpg1.5.x's core?". This thread deals with a particular plugin, and it deals only with the version of Coppermine that it has been designed for in the first place. The board would get cluttered and useless if we allowed postings like yours. Don't!

vapan

Hi all,

Since there is no 1.5 version of this plugin but I'm running 1.5, I made a separate quick hack to implement somewhat the same ideas.
In db_input.php, which registers a new picture in the database, I added a few lines to extract the caption from EXIF unless caption is provided in the web UI form.

Strangely, I also needed to add an UTF encoding, but it might be only because of my weird EXIF writer software. To be safe, you may want to remove the line with "utf8_encode(...)".

Here's a simple patch for that (for version 1.5.16):


*** db_input.php.orig Sun Jan 29 15:43:59 2012
--- db_input.php Sun Jan 29 15:44:07 2012
***************
*** 24,29 ****
--- 24,33 ----
  require('include/mailer.inc.php');
  require('include/smilies.inc.php');
 
+ // PATCH modification: store exif comments
+ require("include/exif.php");
+
+
  /*known issue: code was edited to not count URL in comment character count. However
  this resulted in the character count not being respected at all.
 
***************
*** 668,673 ****
--- 672,695 ----
      }
 
      // Upload is ok
+
+     // PATCH modification: take caption from EXIF if not input separately in form
+    $picture_path =  $CONFIG['fullpath'] . $filepath . $picture_name;
+     // If empty caption in form, take from EXIF
+     if($caption === "") {
+ $exif = read_exif_data_raw($picture_path, true);
+           foreach ($exif as $key => $val) {
+              if($key == 'SubIFD') {
+                   $caption = substr($val['UserCommentOld'], 5);
+              }
+          }
+     }
+     // HACK, make sure is in correct charset
+     // (my photos seem to have such comments that they are not input correctly without this encoding)
+     // For me, this seems to detect "UTF-8" even if it's not, so not cheking but blindly encoding all
+     ////// mb_detect_encoding($caption);
+     $caption = utf8_encode($caption);
+
      // Create thumbnail and internediate image and add the image into the DB
      $result = add_picture($album, $filepath, $picture_name, 0, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $superCage->post->getInt('width'), $superCage->post->getInt('height'));