DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Metadata in TS¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Xavier Perseguers |
Changed: | 2010-08-22T12:05:08 |
Classification: | metadata_ts |
Keywords: | exif, iptc, xmp, metadata, picture, photo, image |
Author: | Xavier Perseguers |
Email: | typo3@perseguers.ch |
Info 3: | |
Info 4: |
EXT: Metadata in TS - metadata_ts
EXT: Metadata in TS¶
Extension Key: metadata_ts
Language:
Keywords: exif, iptc, xmp, metadata, picture, photo, image
Copyright 2008-2010, Xavier Perseguers <typo3@perseguers.ch>
This document is published under the Open Content Licenseavailable from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.org
Table of Contents¶
`Introduction 3 <#__RefHeading__1893_111854446>`_
`Users manual 4 <#__RefHeading__1899_111854446>`_
`Administration 5 <#__RefHeading__1901_111854446>`_
`Configuration 6 <#__RefHeading__1903_111854446>`_
`Tutorial 8 <#__RefHeading__1909_111854446>`_
Automatically rotating pictures 8
`Known problems 10 <#__RefHeading__1915_111854446>`_
`To-Do list 11 <#__RefHeading__1917_111854446>`_
`Further information 12 <#__RefHeading__2240_111854446>`_
`Have more fun with TYPO3! 12 <#__RefHeading__2242_111854446>`_
`ChangeLog 13 <#__RefHeading__1919_111854446>`_
Introduction¶
What does it do?¶
This extension lets users extract metadata from files using TypoScript.
Screenshots¶
A screenshot does not make much sense but I know that it is visually more impressive with one. Thus here is a screenshot of a sample picture I watermarked dynamically with the photograph's name.
Users manual¶
The screenshot was created with TS below:
page = PAGE
page.10 = IMAGE
page.10.file = GIFBUILDER
page.10.file {
XY = [10.w],[10.h]
10 = IMAGE
10.file = EXT:metadata_ts/samples/wbtc05.jpg
10.file.maxW = 400
20 = TEXT
20 {
offset = [10.w]-[20.w]-10,[10.h]-[20.h]+5
fontColor = #ffffff
fontSize = 15
text.cObject = FILEINFO
text.cObject {
file.data = TSFE:lastImageInfo|origFile
metadata.field = EXIF:Author // IPTC:2#080|0
noTrimWrap = |(c) | |
}
}
}
Administration¶
Install the extension as usual.
Configuration¶
Extension Configuration¶
External tools may be specified for extracting EXIF and IPTC data. This is particularly useful if you encounter character set conversion problems with PHP built-in methods for dealing with EXIF and IPTC information.
This extension was tested with command-line tools “exif” and “exiv2”. Proper parameters should ensure that a machine-readable output is generated. The key column is used in TypoScript to retrieve a given value.
exif¶
Suggested configuration:
/usr/bin/exif -m -i
Output will be something like this:
0x010f Canon
0x0110 Canon EOS 300D DIGITAL
0x0112 top - left
0x011a 180.00
0x011b 180.00
0x0128 Inch
0x0131 Adobe Photoshop CS3 Macintosh
0x0132 2008:07:19 10:46:01
0x013b Xavier Perseguers
0x0213 centered
0x0103 JPEG compression
0x011a 72.00
0x011b 72.00
0x0128 Inch
0x829a 1/1000 sec.
0x829d f/7.1
...
Columns in the output are separated by a tabulator (“t”), Key column is at position 0 and Value column at position “1”.
exiv2¶
Suggested configuration:
/usr/bin/exiv2 -px
Output will be something like this:
Xmp.exif.ExposureTime XmpText 6 1/1000
Xmp.exif.FNumber XmpText 5 F7.1
Xmp.exif.ExifVersion XmpText 4 2.21
Xmp.exif.DateTimeOriginal XmpText 25 2005-07-09T13:20:45+01:00
Xmp.exif.DateTimeDigitized XmpText 25 2005-07-09T13:20:45+01:00
Xmp.exif.CompressedBitsPerPixel XmpText 3 3/1
Xmp.exif.ShutterSpeedValue XmpText 12 1/1000 s
Xmp.exif.ApertureValue XmpText 12 F7.1
Xmp.exif.ExposureBiasValue XmpText 3 0
Xmp.exif.MaxApertureValue XmpText 12 194698/65536
Xmp.exif.MeteringMode XmpText 1 Multi-segment
Xmp.exif.FocalLength XmpText 4 70.0 mm
Xmp.exif.FlashpixVersion XmpText 4 1.00
Xmp.exif.ColorSpace XmpText 1 sRGB
Xmp.exif.PixelXDimension XmpText 4 1280
Xmp.exif.PixelYDimension XmpText 3 853
Xmp.exif.FocalPlaneXResolution XmpText 11 3443.95
Xmp.exif.FocalPlaneYResolution XmpText 11 3442.02
Xmp.exif.FocalPlaneResolutionUnit XmpText 1 inch
Xmp.exif.SensingMethod XmpText 1 One-chip color area
Xmp.exif.FileSource XmpText 1 Digital still camera
...
Columns are separated by one or more spaces (“s+”), Key column is at position 0 and Value column at position 3.
Reference¶
file /+stdWrap¶
Property
file /+stdWrap
Data type
wrap
Description
Defines the file to extract metadata from
Default
metadata.field¶
Property
metadata.field
Data type
fieldname
Description
Sets the content to the value $cObj->data[metata.field]
Example: Set content to the value of field “Xmp.exif.ExposureTime”. As it is an EXIF data, prefix it with “EXIF:” and set “.metadata.field = EXIF:Xmp.exif.ExposureTime”
$cObj->data changes. Activate debug mode to list available keys!
Note: You can also divide fieldnames by “//”. Say, you set “EXIF:Author // IPTC:2#080|0” as the value, then the content from the field EXIF:Author will be returned unless it is a blank string, in which case field IPTC:2#080|0 is returned.
Default
debug¶
Property
debug
Data type
boolean
Description
If set, content of $cObj->data is passed to standard method debug().
This is useful if you want to discover available fields that may be used to extract metadata.
Default
[tsref:(FILEINFO)]
Tutorial¶
Photo gallery¶
If you use a gallery extension such as chgallery and you have a lightbox extension (such as perfectlightbox) to show a single picture, then you may use following code to use the IPTC description as title for lightbox:
plugin.tx_chgallery_pi1.gallery.image {
file {
maxW = 139
maxH = 110
}
imageLinkWrap = 1
imageLinkWrap {
enable = 1
typolink {
title.override.cObject = FILEINFO
title.override.cObject {
file.data = TSFE:lastImageInfo|origFile
metadata.field = EXIF:Subject // IPTC:2#005|0 // IPTC:Xmp.dc.title
}
parameter.override.cObject = IMG_RESOURCE
parameter.override.cObject.file.import.data = TSFE:lastImageInfo|origFile
parameter.override.cObject.file.maxW = 800
parameter.override.cObject.file.maxH = 600
ATagParams = rel="lightbox"
ATagParams.override = rel="lightbox[presentlb{field:uid}]"
ATagParams.insertData = 1
}
}
}
Automatically rotating pictures¶
Following code will automatically rotate the picture you specify. Many newer digital cameras (both dSLR and Point & Shoot digicams) have a built-in orientation sensor. Virtually all Canon and Nikon digital cameras have an orientation sensor. The output of this sensor is used to set the EXIF orientation flag in the image file's metadata to reflect the positioning of the camera with respect to the ground. Canon calls their sensor the “Intelligent Orientation” sensor. It is presumably a 2-axis tilt sensor, allowing 4 possible orientations to be detected (shown in the diagram below):
page.10 = CASE
page.10.key.cObject = FILEINFO
page.10.key.cObject.file = fileadmin/photos/IMG_1040.JPG
page.10.key.cObject.metadata.field = EXIF:Orientation
# Orientation is landscape
page.10.default = IMAGE
page.10.default {
file < page.10.key.cObject.file
file.maxH = 400
file.maxW = 400
altText.cObject < page.10.key.cObject
altText.cObject.metadata.field = IPTC:2#005|0
}
# Orientation is portrait
page.10.6 < page.10.default
page.10.6.file.params = -rotate 90
page.10.8 < page.10.default
page.10.8.file.params = -rotate -90
Known problems¶
None
To-Do list¶
- Supporting other metadata as EXIF and IPTC for pictures
- Supporting any file type that may contain metadata (sound, PDF, movies, ...)
- Using metaExtract* services instead of recoding all metadata extraction procedures
Further information¶
Do not hesitate to visit the extension's website on Forge:
http://forge.typo3.org/projects/show/extension-metadata_ts
Have more fun with TYPO3!