(Another) request for a customisable info module

undagiga

Joined: 2010-11-26
Posts: 693
Posted: Mon, 2010-12-13 23:48

I searched and I found a few requests for a photo info module that could be customised. The response is usually to hack either the info or rwinfo modules. I hope this is possible in my case. I want to present one EXIF field, one IPTC field and tags. But I would have thought that this is such an obvious thing that someone would have taken the idea beyond rwinfo by now, and made it something that you could configure in the admin module.

I know I will be invited to do this myself. I would if I could. I'm not new to basic coding but I am totally new to PHP and other things that G3 is built on (jquery?). It would take a very long time.

U-G

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2010-12-17 19:33

Which EXIF field do you want, and which IPTC field? It's probably not that hard. You've been a great contributor on the forums, I'll be happy to write it for you as a one-off and stick it in gallery3-contrib.
---
Problems? Check gallery3/var/logs
file a bug/feature request ticket | upgrade to the latest code | use gallery3 from git

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Sat, 2010-12-18 11:01

Bharat

Thank you. That's a very generous offer and I would find it hard to say no. The fields I would like are:

Exif Date Original (format 16 December 2010)
Exif Time Original (format 17:15:00)
IPTC Source
Tags for the image

I'm looking for something that would display just for resize pages.

I have experience in Perl5 (years ago now), javascript, visual basic (lots) and C++ (a little). I hope that over time I can contribute, but it will mean self-learning another #$%*$&!! language. Perhaps I can develop whatever you write. I think that something that can be configured via the admin settings would be of general interest.

Thank you again.

U-G

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2010-12-20 01:43

I wrote a module for you called about_this_photo and pushed it to the gallery3-contrib repo, so it should show up on http://gallerymodules.com shortly. I couldn't easily grab the IPTC Source field and ran out of time, but take a look, it's at least a good starting point.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Mon, 2010-12-20 09:04

Thank you Bharat. That's very kind and much appreciated. I am travelling for a few days with just my Netbook and a mobile phone. I will take a closer look in a few days when I'm back in front of my desktop.

U-G

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Wed, 2010-12-22 10:59

I'm now back in front of my desktop, albeit a bit tired. This module works a treat. Thank you very much.

I'm going to try to add the IPTC field myself as a learning exercise. Looking at the module you wrote for me this appears deceptively simple. However looking at the IPTC module for clues about how to access the ITPC field in question is a bit scary. A large part of this is no doubt because it can be configured in the admin area.

Is this thread the best place to ask questions as I try to progress this?

U-G

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Thu, 2010-12-23 11:40

After a long string of careless mistakes by a newbie, I have included the IPTC field. I used the following code in about_this_photo_block.php with a corresponding entry in the view:

      // IPTC - copied more or less from iptc.php
      if (module::is_active("iptc")) {
	    $record = ORM::factory("iptc_record")->where("item_id", "=", $theme->item()->id)->find();
   	    if ($record->loaded()) {
          $record = unserialize($record->data);
          $block->content->source = $record["Source"];
  	    }
      }

I also needed to include a test to ensure that this only displayed on photo pages. While it didn't cause major problems without this test on album pages, it did on pages like "contact owner".

I also had a minor problem with formatting in the view. The use of ul/li caused a large indentation of the text. I looked at the IPTC module and it uses the exact same ul/li structure and css and didn't have the indentation. I couldn't for the life of me see why the difference. To remove the indentation I switched to span & br. Why does one module using ul/li have a large indentation and another not?

Thanks again for all your help. I will play with this a little more, but once I've finished, what is the best way to have my changes included in the repository?

U-G

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2010-12-28 16:57
Quote:
but once I've finished, what is the best way to have my changes included in the repository?

Create a fork of the -contib repository. Make changes to your repository and send Bharat a pull request of your changes.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Sat, 2011-01-01 08:31

I have struggled with the whole GIT concept. I think I've done it, although my updates were added to the 3.1 branch. Is this normal, or did I do something wrong?

U-G

 
mrf00rk
mrf00rk's picture

Joined: 2005-06-02
Posts: 158
Posted: Sat, 2011-01-01 10:27

It would be cool if the IPTC could make tags for different lenses, cameras, flash used/not used etc. And thus sorting all images shot with 200mm for example:)

My other sandbox

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Sat, 2011-01-01 11:47

That information should be in EXIF, and if someone understood the structure of EXIF it could be added to the module fairly readily. Or better, a more EXIF-oriented version created. But I don't see how you will be able to use it to sort.

U-G

 
undagiga

Joined: 2010-11-26
Posts: 693
Posted: Sat, 2011-01-01 13:16
undagiga wrote:
I have struggled with the whole GIT concept. I think I've done it, although my updates were added to the 3.1 branch. Is this normal, or did I do something wrong?

I've just realised what I've done wrong. I did add the updated module code to the local copy of 3.1 rather than 3.0. How embarrassing. I won't do any more until I'm told whether I should remove this and add it to the 3.0 branch instead, or leave it as it and add it to 3.0 as well, or what.

I'd also appreciate advice on how to add a completely new module to GIT. Can I do this, or does someone in the team have to initiate it? Should I post it in the forum first?

U-G

 
mrf00rk
mrf00rk's picture

Joined: 2005-06-02
Posts: 158
Posted: Sun, 2011-01-02 08:18
undagiga wrote:
That information should be in EXIF, and if someone understood the structure of EXIF it could be added to the module fairly readily. Or better, a more EXIF-oriented version created. But I don't see how you will be able to use it to sort.

U-G

My other sandbox

Sorry, I was talking about EXIF. And by sorting I was talking about the tags. When you click on a tag you are sorting by that tag. In my book anyway ;) And this could be in its own block, not mixed with the other tags.