Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: [Closed]: adding exif date to user1 column  (Read 6358 times)

0 Members and 1 Guest are viewing this topic.

vktr

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
[Closed]: adding exif date to user1 column
« on: October 28, 2009, 02:29:33 am »

Hi,

I just started with coppermine, looks great. I'd like to have a plugin to populate user1 column of the pictures table with date from exif info. I'm trying this:

Code: [Select]
$thisplugin->add_filter('add_file_data', 'exif2user');

function exif2user($pict_data) {
    $fullpath = $pict_data['filepath'] . $pict_data['filename'];
    $exif = read_exif_data_raw($fullpath, true);
    $pict_data['user1'] = ??????????????;

    return $pict_data;
}

How do I get the content of 'DateTime digitized' field from $exif? Does this hook really execute once when a file is added?

Thanks,
Viktor
« Last Edit: October 29, 2009, 09:01:20 am by Joachim Müller »
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1323
  • Fishing relaxes me.
    • Bailey Family Co.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

vktr

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: adding exif date to user1 column
« Reply #2 on: October 28, 2009, 05:02:19 am »

http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616

Quote
8. Post links
When posting a support request, it's helpfull for supporters in most cases to see what the actual page looks like, that's why it's mandatory that you always post a link to your coppermine gallery page when asking for support. If your site contains adult content, make sure to post a warning together with your link!

Well, it looks like any other coppermine gallery (looks great). Any hint on how to get the exif info from within a plugin? Thanks.
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1323
  • Fishing relaxes me.
    • Bailey Family Co.
Re: adding exif date to user1 column
« Reply #3 on: October 28, 2009, 06:08:24 am »

I'm Sorry I wasn't clear before... The board rules are saying that you must post a link to your gallery before you will receive support. There is a mod that does something similar, you'd know this if you read the rules and did a search  ;) 
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

vktr

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
[solved] adding exif date to user1 column
« Reply #4 on: October 29, 2009, 01:21:46 am »

So here is the solution. Indeed, PhotoComment plugin has a similar thing.

Code: [Select]
include_once('include/exif.php');
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$thisplugin->add_filter('add_file_data', 'exif2user');

function exif2user($pict_data) {
    global $CONFIG;

    $fullpath = $CONFIG['fullpath'] . $pict_data['filepath'] . $pict_data['filename'];
    $exif = read_exif_data_raw($fullpath, true);

    if (isset($exif) && is_array($exif)) {
    foreach ($exif as $k => $v) {
    if ($k == 'SubIFD') {
                $pict_data['user1'] = substr($v['DateTimedigitized'], 0, 10);
            }
    }
    }
    return $pict_data;
}

P.S. php does feel a bit weird  ;)

Cheers,
Viktor

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [solved] adding exif date to user1 column
« Reply #5 on: October 29, 2009, 09:09:04 am »

php does feel a bit weird  ;)
Hm...

In the future, please do as supporters and board rules suggest. Marking thread as "closed", as you haven't really resolved it properly (again: please read up board rules).
You haven't supplied enough details to enable us to answer your actual question: it depends on the plugin hook you use. In PHP as well as in any other programming language, it depends on the context, so you should have told us what you already ahev and where you need to call the needed data from.
Example from the real world: You can't ask "how do I drive a vehicle?", as this depends on the type of vehicle you want to drive and a number of other factors that have an impact. The same thing applies for programming as well: you need to make sure that the processing results /data that you want to re-use are already present (i.e. they must have been processed already) and you need to make sure to respect the particular rules that exist for programming languages (in PHP: make sure to understand the scope of variables).
Logged

vktr

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: [Closed]: adding exif date to user1 column
« Reply #6 on: October 29, 2009, 09:56:23 am »

Joachim Müller, I have no idea what you are talking about. What details are missing? All I wanted was to populate the user1 field when a file is added, as stated in the original post. Still not clear?? Or you mean I didn't post the URL of my private photo gallery? That's a plain stupid request if you ask me. Or is my solution bad? In what regard? If it's bad, then please correct it. In any case it works for me :)

What a strange place this is for an open source community LOL

Cheers,
Viktor
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [Closed]: adding exif date to user1 column
« Reply #7 on: October 31, 2009, 11:56:42 am »

What details are missing?
Have you actually bothered to click the link in Jeff's initial reply in this thread:
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
and read the section you quoted yourself? It says that it's mandatory to post a link to your gallery if you want help. You claim to be from Canada so I expect you know the meaning of the word "mandatory". I can't spot that link to your gallery anywhere, so there no further help for you - simple as that.
Logged

vktr

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: [Closed]: adding exif date to user1 column
« Reply #8 on: November 01, 2009, 05:37:04 am »

Joachim Müller, all I can say you're fucking idiot. Coppermine is great, I'm converting hundreds of my albums to it. Thanks to all developers who made it happen. Wonderful project, I wish I could participate, but it looks like you've got a bunch of assholes on board.... Again, my ultimate respect to the developers, guys, you rock. Thanks!!

8)

Cheers,
Viktor
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4713
    • Windsurf.me
Re: [Closed]: adding exif date to user1 column
« Reply #9 on: November 01, 2009, 11:26:08 am »

Hi Viktor,

Guess what, you are banned, out of here, outstayed your welcome, gone. See ya.

Don't bother coming back. Comments like your above show just the kind of nice person you are.
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 21 queries.