Announcement

#1 2010-11-02 11:26:04

brough
Member
2010-08-27
15

[resolved] IPTC data for Image Page Title

I am using my_header.tpl to replace header.tpl.

I'm attempting to extract IPTC info from the Headline field and put it into the Title tag in the template, thus:


<title>{$INFO_HEADLINE} | {$PAGE_TITLE}</title>{else}
<title>{$INFO_HEADLINE} | {$GALLERY_TITLE}</title>{/if}


However, it does not work. Can anyone tell me if it's possible to do this?

Offline

 

#2 2010-11-02 17:41:32

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: [resolved] IPTC data for Image Page Title

When you've extracted is what you assign them to the template

example plugin

add_event_handler('loc_begin_page_header', 'TitleIPTC');

function TitleIPTC()
{
        global $template, $page;

              if ( !empty($page['image_id']) )   
                {

What did you do to recover the IPTC

$IPTC='What you want to send';

        if (!empty($IPTC))
            {
                $template->assign('INFO_HEADLINE', $IPTC);
            }
                }
}


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2010-11-02 23:27:23

brough
Member
2010-08-27
15

Re: [resolved] IPTC data for Image Page Title

You wrote
"What did you do to recover the IPTC"
That sounds like a question, but I don't understand. Perhaps it's actually a statement, which would be better written "This is how you recover the IPTC"

I'm afraid I'm very new to this system and have little understanding of the language. Can you tell me where I should put this code snippet?

Many thanks.

Offline

 

#4 2010-11-03 00:12:59

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13789

Re: [resolved] IPTC data for Image Page Title

I think the question is did you configure Piwigo to use your IPTC Headline? Is it mapped to an image property?

Offline

 

#5 2010-11-03 04:09:24

brough
Member
2010-08-27
15

Re: [resolved] IPTC data for Image Page Title

Yes, I have it configured to read IPTC data from the image, as you'll see on the following page:
http://www.cybermotorcycle.com/piwigo/p … category/6

Cheers

Offline

 

#6 2010-11-03 11:43:02

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13789

Re: [resolved] IPTC data for Image Page Title

1) install + activate the LocalFiles Editor plugin.

2) open [Administration > Plugins > LocalFiles Editor > Local config] and paste:

Code:

<?php
$conf['use_iptc'] = true;

$conf['use_iptc_mapping'] = array(
  'name'            => '2#105',
  'comment'         => '2#120'
  );
?>

And then perform a metadata synchronization on your photo (from the photo administration page for example)

Please tell us if you reach the desired result.

Offline

 

#7 2010-11-03 12:30:14

brough
Member
2010-08-27
15

Re: [resolved] IPTC data for Image Page Title

Brilliant! That works.

I'm now getting very close to my goal, and I'm delighted with Piwigo and amazed at the quality of support.

Here is what I have now:
http://www.cybermotorcycle.com/piwigo/p … ategory/65
shows the title
DEMM 1961 Unificato 49cc 1961 (I've made a mistake and put the mfg date in twice)
and the following page
http://www.cybermotorcycle.com/piwigo/p … ategory/65
shows the title
DEMM Unificato 49cc 1961

My config now reads:
<?php
$conf['use_iptc'] = true;

$conf['use_iptc_mapping'] = array(
  'keywords'        => '2#025',
  'name'            => '2#105',
  'comment'         => '2#120'

  );
?>

(I already had the keywords working using the ddtddt mod, thanks)

I could not figure out how to do the metadata synchronization - I can find nothing in the forums which is relevant, and naught in the help files either. I created a new album using ploader.

It would be great if someone were to address that issue at some time, if an issue (bug) it is.

Many thanks again.

Offline

 

#8 2010-11-03 14:04:57

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13789

Re: [resolved] IPTC data for Image Page Title

brough wrote:

I could not figure out how to do the metadata synchronization - I can find nothing in the forums which is relevant, and naught in the help files either. I created a new album using ploader.

It would be great if someone were to address that issue at some time, if an issue (bug) it is.

Unfortunately, there is currently no tool to synchronize metadata on several photos at once if they have been added with pLoader or the web form, this is why we created [Bugtracker] ticket 1866

I've just written a small personnal plugin as an immediate workaround.

1) activate the LocalFiles Editor plugin

2) go to [Administration > Plugins > LocalFiles Editor > Personal Plugin] and paste the following code:

Code:

<?php
/*
Plugin Name: Personal Plugin
Version: 1.0
Description: Personal Plugin
Plugin URI: http://piwigo.org
Author:
Author URI:
*/

add_event_handler('loc_begin_admin', 'batch_metadata_sync');
function batch_metadata_sync()
{
  if (!isset($_GET['page']) or 'element_set' != $_GET['page'])
  {
    return null;
  }

  if (isset($_GET['mode']) and 'unit' == $_GET['mode'])
  {
    return null;
  }
  
  $trigger_caddie_actions = array('empty_selected', 'add_selected');
  if (!isset($_POST['caddie_action']) or !in_array($_POST['caddie_action'], $trigger_caddie_actions))
  {
    return null;
  }
  
  if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
  {
    return null;
  }

  $query = '
SELECT id, path
  FROM '.IMAGES_TABLE.'
  WHERE id IN ('.implode(',', $_POST['selection']).')
;';
  $id_to_path = array();
  $result = pwg_query($query);
  while ($row = pwg_db_fetch_assoc($result))
  {
    $id_to_path[$row['id']] = $row['path'];
  }
  
  update_metadata($id_to_path);
}
?>

3) go to [Administration > Plugins > Manage], install and activate the "Personal Plugin"

4) go to [Administration > Categories > Manage] and click on the "Manage category elements" icon on the line of your category. You are on the photo batch manager, filtered on a given category. Select some photos and click on the "Add selected elements to caddie" option + "Submit". All the selected photos have been synchronized for metadata.

It also works when you remove photos from caddie in the photo batch manager.

Unfortunately, you have to select photos, you can't apply on all at once :-/ I need to think deeper to make this possible.

Offline

 

#9 2010-11-03 15:08:46

brough
Member
2010-08-27
15

Re: [resolved] IPTC data for Image Page Title

Excellent, works great!

I made a mistake when I set up this server some time ago and it lacks suPHP - as a result, many things don't work as they should including aspects of Piwigo. I'm referring of course to file ownership which is 99 when using ploader and (username) when using FTP.

So it will be a little while until I have this wonderful program working at full speed.

Next step will be to convert my current forum from phpbb to FluxBB.

Cheers for now.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact