Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: EXIF UserComment plugin  (Read 38570 times)

0 Members and 1 Guest are viewing this topic.

JohanLundin

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 1
EXIF UserComment plugin
« on: March 16, 2006, 06:00:40 pm »

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]
« Last Edit: March 05, 2010, 07:46:22 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: EXIF UserComment plugin
« Reply #1 on: March 16, 2006, 11:56:50 pm »

Thanks for your contribution. Here's the instructions from your page and the plugin zip file (in case your server goes down):
Quote
PhotoComment 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

  
« Last Edit: March 05, 2010, 07:46:36 am by Joachim Müller »
Logged

Mats

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #2 on: June 12, 2006, 01:35:22 pm »

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

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1608
  • Paul Van Rompay
Re: EXIF UserComment plugin
« Reply #3 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.
Logged

Mats

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #4 on: June 12, 2006, 03:27:44 pm »

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:
Code: [Select]
Utsikt fr宠v岠hotellterass
Should be:
Code: [Select]
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:
Code: [Select]
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:
(http://www.home.no/masken/pics/cpg_error_usercomment_plug-in.JPG)

Anyone with a clue?
« Last Edit: June 12, 2006, 04:27:31 pm by Mats »
Logged

Mats

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #5 on: June 12, 2006, 04:27:51 pm »

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

Mats

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #6 on: June 13, 2006, 07:17:58 pm »

Noone? :(
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Logged

Mats

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #8 on: June 18, 2006, 09:42:20 pm »

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...
Logged

Nibbler

  • Guest
Re: EXIF UserComment plugin
« Reply #9 on: June 19, 2006, 12:18:06 am »

> maybe nobody knows the answer to your problem

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

rjbearcan

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #10 on: January 24, 2010, 10:15:29 pm »

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?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: EXIF UserComment plugin
« Reply #11 on: January 24, 2010, 10:56:27 pm »

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.
Logged

rjbearcan

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: EXIF UserComment plugin
« Reply #12 on: January 26, 2010, 06:54:35 am »

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.
Logged

mykee

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: hu
  • Offline Offline
  • Gender: Male
  • Posts: 140
    • One moment from Hungary
Re: EXIF UserComment plugin
« Reply #13 on: June 12, 2010, 10:57:27 am »

@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?
Logged
My gallery and demo for AnythingSlider, Photocols and CollagePlus plugin: http://foto.acegem.hu/index.php

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: EXIF UserComment plugin
« Reply #14 on: June 12, 2010, 06:21:58 pm »

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!
Logged

vapan

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: EXIF UserComment plugin
« Reply #15 on: January 29, 2012, 02:47:14 pm »

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):

Code: [Select]
*** 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'));

Logged
Pages: [1]   Go Up
 

Page created in 0.048 seconds with 21 queries.