#2 — Customize unweb.iptc

State Resolved
Area Functionality
Issue type (missing)
Severity Critical
Submitted by admin
Submitted on Nov 09, 2022
Ticket Owner
I use unwed.iptc 0.3.1 to import metadata contained in my photos into a Plone image. I installed it properly. It works, sort of. At least most metadata was imported along with the image. There are a few modifications that need to be made in the import code: 1. The version name (which is in the metadata produced by Aperture, my photo processing software, upon export of an image) is currently imported into the short name (part of the URL). I need it to import the title (not version name) into the short name (title is exported into the metadata of the image, so it should be importable, as it is in the Title of the Plone image). 2. Location metadata (Image Location, Image City, State/Province and Country) import, but they are imported backward and the fields are not separated by commas. [Before we do #2, we need to find out if a lat/long is actually stored in the photo metadata. If so, then we need to think about how to automatically turn this into a place name in the location field of the Plone image upon import.] [I suspect lat/long is in the image metadata somewhere, as Google uses it to create a Location field in Aperture (the photo processing software I use). The Location field is populated even by county name.] [If we can use lat/long, then let's use it to populate the Location field in Plone's image type with English language place names. If there is no data in the lat/long metadata, then let's use what is imported into the Plone image type, as above (reversing order and inserting commas).] 3. No creation date is imported into the Publishing Date field. 4. The name that populates the Creator field in a Plone image is the same as it is in the creator metadata of the photograph. I need it to be transformed a bit. For example, "Marshall Mayer" is imported. I need it to be transformed from "Marshall Mayer" to "marshall-mayer" in the import process. Make this process independent of my name (example: "Mark Johnstone" is imported as "mark-johnstone"). These corrections will need to be made before I import all my photos. [I might want to do the exports from iPhoto, which many more people have to scale the app, so I will need to test this export first.]

Change History

Added by Marshall Mayer on Oct 07, 2013 02:45 PM
Here is the original of the photo we uploaded today. Download this original to upload again for testing (you can delete previous versions).
Added by Marshall Mayer on Oct 07, 2013 02:45 PM
Here is the original of the photo we uploaded today. Download this original to upload again for testing (you can delete previous versions).
Added by Marshall Mayer on Oct 07, 2013 02:46 PM
Also, I tested another photo program (iPhoto) to use for exporting my images, and it won't work as well. So whatever you do to modify unweb.iptc for Aperture (my favored photo program, the program I used to export IMG_1212.jpg), we'll need to tell unweb.iptc to look for Aperture v3.4.5 (or greater) to proceed with this set of rules. If no (which there won't be for now), then it looks for another program that generated the export (and thus invoke a different set of import maps).
Added by suresh on Oct 11, 2013 12:55 AM
Lat/lon not available on the photo you have attached.

Info available is:

[(116, 'Image and Text Copyright \xc2\xa9 takenote.net\xe2\x84\xa2. Some rights reserved under a Creative Commons license.'), (5, 'Trouble on the Horizon'), (80, 'Marshall Mayer'), (20, []), (85, 'Note Taker'), (118, []), (25, ['take-note.com']), (122, 'Marshall Mayer'), (101, 'USA'), (90, 'Rosebud'), (95, 'MT')]


Added by suresh on Oct 11, 2013 12:57 AM
It does not contain creation date either. We can use upload date but that may not make sense.
Added by suresh on Oct 11, 2013 01:30 AM
Have implemented some of the other things. Please test.
Added by Marshall Mayer on Oct 11, 2013 10:06 AM
#1 above is resolved.

#2 is almost there. I guess if we can't use lat/lon, then let's insert commas between the fields (except between state/province and country). Notice that in my test (Another Griff), there is a street address in there as well, so a comma should separate it an the city.

#3 is there no other place were metadata is stored in the photo? I don't have the tools to inspect.

#4 is resolved.
Added by Marshall Mayer on Oct 11, 2013 10:18 AM
The IPTC metadata has to be embedded in the file somewhere. I'm using another program to inspect the file's metadata, and see the Digital Creation Date and Digital Creation Time in the IPTC metadata (screenshot attached). Another screenshot coming...
Added by Marshall Mayer on Oct 11, 2013 10:22 AM
Using the same tool, I can also see the GPS metadata, including the lat/lon (and altitude and the direction the camera is pointing!). That's Helena in the red crosshairs on the map.

This metadata is from an exported image, so it is in the test file I sent you. We just have to figure out where it is and how to get it into Plone, using a modified unwed.iptc.
Added by Marshall Mayer on Oct 11, 2013 10:32 AM
I used a text editor to inspect the data. I can find IPTC metadata in it but the GPS metadata is encoded. See attached, and search for "2013" (the year the photo was taken. Beside it you will find the full date and time of the original photo. (9:37:01 AM today).
Added by suresh on Oct 14, 2013 03:10 AM
I tested both the ITPC and GPS images.

Don't see any metadata inside them.

unweb.iptc depends on a python library called IPTCInfo to extract the metadata. May be that is not doing the entire job. We may need to modify both unweb.iptc and IPTCInfo.
Added by suresh on Oct 14, 2013 03:43 AM
I looked at these and other images from the front page.

Only Griff seems to have some metadata.

{'keywords': ['take-note.com'], 'by-line': 'marshall-mayer', 'supplemental category': [], 'contact': [], 'object name': 'Griff'}

May need more images. Can you zip a few of them with metadata and send them.

Also indicate what fields you have added to them.
Added by Marshall Mayer on Oct 14, 2013 11:03 AM
Here are a few images. I've also created a metadata map at https://docs.google.com/spr[…]aUE&usp=drive_web#gid=0 which hopefully will fill in the blanks indicated above.
Added by suresh on Oct 15, 2013 12:05 AM
Checkout the metadata from 3 different programs.

If the one from_exifread is sufficient, that would be easiest.
Added by Marshall Mayer on Oct 15, 2013 07:33 AM
The data we need is in from_exifread.
Added by suresh on Oct 16, 2013 03:08 AM
I have uploaded a test image. The date is showing correctly. I have also added the code to get the location. But location specified in IPTC will override. So you have to test with image that does not specify location as part of IPTC.
Added by Marshall Mayer on Oct 16, 2013 09:51 AM
I tested by adding 5 images (see last 5 in review list to Publish). Dates are imported, correctly, so this resolves #3 above. Location (#2 above) still needs some work. See the text I included in http://emediacy.org:8080/take-note/niagara-falls/view.
Added by suresh on Oct 16, 2013 11:15 AM
may be something to do with east/west. Will check.
Added by Marshall Mayer on Oct 16, 2013 05:26 PM
if that works, do the same thing for north/south.
Added by suresh on Oct 17, 2013 05:08 AM
made the change. can you test?
Added by Marshall Mayer on Oct 17, 2013 08:02 AM
It works! See the new image on the front page (Livin' the High Life...). The original data in Location was "8 1st Avenue Southwest, Cut Bank, MT 59427, USA" Which is the actual street address of where I took the picture (see the house number on the front of the house). It may be too much data! But I can edit it down as I need to (which I did on this image). Amazing.

I think we can close this issue.
Added by Marshall Mayer on Nov 19, 2013 11:31 AM
One last change: there is a ZIP code that is automatically appended to the location (see http://emediacy.org:8080/take-note/img_3716.jpg/view where 44004, appears just before USA). I will have to strip that out on every image. Can you trap for that, and strip out the ZIP code and following comma?
Added by Marshall Mayer on Apr 04, 2014 04:19 PM
Added by suresh on Jul 05, 2014 01:07 AM
is this fixed?
Added by Marshall Mayer on Jul 05, 2014 06:53 AM
Just the last item, on removing ZIP codes, needs to be done. Otherwise, the customizations are working.
Added by suresh on Jul 07, 2014 12:33 AM
Checked a few images, don't see the ZIP code. Can you send me a link as to where to find it?
Added by Marshall Mayer on Jul 07, 2014 07:29 AM
I had already removed the ZIP codes from those images. See http://take-note.com:9080/[…]/view, which I just added. It still has it's ZIP code and comma. I don't want to have to remove the ZIP code and comma for every image that I upload to the site.
Added by suresh on Jul 07, 2014 11:56 PM
Something bizarre is going on.

http://localhost:8080/[…]/image_view works but http://localhost:8080/take-note/apartment-for-rent/view does not.

No idea why. Can you think of something?
Added by suresh on Jul 08, 2014 12:19 AM
never mind.. needed refresh
Added by Marshall Mayer on Jul 08, 2014 06:35 AM
The approach you've taken is not quite right. Notice that "20," is also removed from http://take-note.com:9080/[…]/view, So that the address reads "between 1124 and 1138 U.S. Ashtabula, OH USA" when it should read "between 1124 and 1138 U.S. 20, Ashtabula, OH USA". The "20," data is still in the location field under the Categorization tab (in edit mode) but it has been stripped out to present in the view.

The better approach is to look for ZIP code in the IPTC metadata of the original image, and as it is imported into Plone remove it so that it never enters the location field. You've done other transforms that way.
Added by Marshall Mayer on Jul 08, 2014 06:42 AM
I'll upload a couple of images so that you can test.
Added by Marshall Mayer on Jul 08, 2014 06:42 AM
Here's another one.
Added by suresh on Aug 25, 2014 12:55 AM
Have improved this. So check now.
Added by Marshall Mayer on Aug 25, 2014 07:24 AM
Seems to work. What did you do?
Added by Marshall Mayer on Aug 25, 2014 11:42 AM

No responses can be added.

Document Actions