Differences

This shows you the differences between two versions of the page.

Link to this comparison view

user_documentation:metadata [2008/02/29 22:56]
mathiasm
user_documentation:metadata [2019/03/23 10:15] (current)
executive [What's all this 'metadata' stuff, anyway?]
Line 1: Line 1:
 ====== Metadata ====== ====== Metadata ======
  
-==== Introduction ====+<WRAP center info round 60%>This is an advanced topic. If you are new to Piwigo, take the [[http://piwigo.org/ext/extension_view.php?eid=776|tour]] before reading this.</WRAP>
  
-Metadata are data contained directly in files. Even if you loose your database, those data will survive :-) Examples of metadata : filesize, width & height (for a picture), EXIF metadata, IPTC metadata, ID3 tags (mp3 file format).+==== What's all this 'metadata' stuffanyway? ====
  
-==== Showing metadata ====+Metadata is information about information. An example would be the album and artist information contained in the ID3 tag of an MP3 song file. In the case of image files, this includes things such as height and width, as well as Exif and IPTC blocks, which are written to a file when a digital camera takes a photo. Also, additional metadata can be written to the image file later in software, such as keywords. Metadata can be useful to the software you use, as well as to humans. Images may contain so called Exif and IPTC tags (one or both). Metadata can be used with many different types of file formats (JPEG, TIFF, RAW etc.). 
 +The future of metadata will likely be decided by [[https://en.wikipedia.org/wiki/Metadata_Working_Group|Metadata Working Group]] Other examples of image metadata are ICC color profiles, and Extensible Metadata Platform (XMP), the successor to IPTC.
  
-On the presentation page of an element (a picture, most of times) PhpWebGallery proposes you to show metadata : use the ''show file metadata'' button in the navigation bar. Depending on the configuration, filtered metadata will be shown.+=== Basic metadata ===
  
-This solution is the most simpleBut you must be aware that metadata informations can't be used for search. If the creation date of a photograph is in the EXIF metadata set only (and not in the database)gallery visitors won't be able to find this photograph if they search elements of the same date of creation. The solution for this is **using** metadata instead of only **showing** metadata.+Basic metadata are things like filesize, width/height, color depth and sometimes even thumbnailsAll images must have this data, and it is needed by browsers and other software to display the image properly. Historicallythis data wasn't considered to be metadata, but in reality it is.
  
-=== Basic metadata ===+=== Exif ===
  
-Basic metadata are filesize, width and heightThey are shown by default in the element properties listHistoricallythose data have never been considered as metadata but in realitythey are.+[[https://en.wikipedia.org/wiki/Exif|Exif]] (Exchangeable image file format) tags are typically used to **describe how a photo was captured**. The standard was created by a consortium of Japanese hardware manufacturers. For example, tags can contain information about the model of camera/smartphone used, lens, aperature size, focal length, exposure duration, date/time, GPS coordinates, etc. It could also contain scanner properties.  There are //many// fields defined by the Exif specification, but the ones used in a particular file will vary by the device used. Since it is an open standardtag usage should be consistent across various software.
  
-=== EXIF ===+=== IPTC ===
  
-You can configure the EXIF metadata to show in //include/config.inc.php//, here is an extract from release 1.4.0 :+[[https://iptc.org/standards/photo-metadata/iptc-standard/|IPTC]] headers are described by the Information Interchange Model (IIM). The header is named after the International Press Telecommunications Council (based in London), who created the standard in the 1990's to make it easier for news agencies to exchange information using computers. Adobe helped to bring this standard to public use. For our images, the IIM serves a purpose different from Exif; It **describes the content of the image**Some cameras will allow you to record your name, and other copyright information to a digital photo, using this header. Sometimes, editing software is used to later add information like titles. headlines, captions, descriptions, keywords etc. Again, there are many possible fields described in the standard, and they are readable by most programs.
  
-&lt;code php&gt+=== MakerNotes === 
-// show_exif_fields : in EXIF fields, you can choose to display fields in + 
-// sub-arraysfor example ['COMPUTED']['ApertureFNumber']. for thisadd +IPTC and Exif are open standards, but hardware manufacturers have their own secret sauce as well. Cameras will often record some metadata to digital photos which is proprietary, and sometimes device specific. Sometimes it is used by the cameras themselves, and sometimes by image processing software distributed by the companies with their cameras. For example, the Makernotes may include points on an image that the camera used for autofocusing, shutter sync, or noise reduction data. Since this metadata may reveal how a particular device works internally, companies do not publish the specifications to protect their intellectual property (IP). Despite this, many Makernotes have been [[http://www.exiv2.org/makernote.html|reverse engineered]]. 
-// 'COMPUTED;ApertureFNumber' in $conf['show_exif_fields'] + 
-// +==== How Piwigo Handles Metadata &quot;Out of the Box&quot==== 
-// The key displayed in picture.php will be $lang['exif_field_Make'for + 
-// example and if it existsFor compound fieldsonly take into account the +Piwigo has many ways to display and use metadata, and improvements are sometimes made in updates. Since metadata is stored within each image, it remains intact even if something happens to your Piwigo database.  
-// last part : for key 'COMPUTED;ApertureFNumber'you need + 
-// $lang['exif_field_ApertureFNumber'] +By defaultPiwigo displays some **basic** metadata on the photo page (dimensions, filesize etc.).  When the metadata button is clicked (camera icon with 'i')some additional **Exif** metadata will be shown: Camera Make+Model, image capture date+time, and aperature F-number. Piwigo does not display IPTC metadata. 
-// + 
-// for PHP version newer than 4.1.2 : +When you import images into Piwigo, the DateTimeOriginal field is extracted from the Exif metadata, and copied into the Piwigo database. It becomes the image's ";Created on" property (which is searchable).  
-// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime')+ 
-//  +==== Expanding Piwigo's Metadata Capabilities ==== 
-$conf['show_exif_fields'] = array('Make', + 
-                                  'Model', +** Note:** For some functions, in may be necessary to install [[http://piwigo.org/ext/extension_view.php?eid=199|Grum Plugin Classes]]. Also, the metadata available to you depends on the version of PHP your server uses. 
-                                  'DateTime', +(Recommended as of Mar-2018: version 5.6) 
-                                  'COMPUTED;ApertureFNumber');+ 
 +Firstly, it helps to learn exactly what metadata your images contain, and what Piwigo can accessFortunatelyyour standard Piwigo installation already has a tool to inspect some of your Exif and IPTC image metadata. Copy any sample jpeg image to this path: (it must have this file name) 
 +<code> [your piwigo folder]/tools/sample.jpg<;/code> 
 +Thenopen this link in your browser: 
 +<code> [your gallery URL]/tools/metadata.php</code> 
 +You should see a page of text that looks like this: 
 +<code> 
 +Informations are read from sample.jpg 
 + 
 + 
 +IPTC Fields in sample.jpg 
 + 
 +1#090 = %G 
 +2#000 =  
 +2#005 = exampledocumenttitle 
 +2#025 = keyword1,keyword2 
 +2#055 = 20170622 
 +2#060 = 100209+0000 
 +2#062 = 20170622 
 +2#063 = 090209+0000 
 +2#080 = mrphotographer 
 +2#105 = exampleheadline 
 +2#120 = exampledescription 
 +2#122 = exampledescriptionauthor 
 + 
 + 
 +EXIF Fields in sample.jpg 
 + 
 +Array 
 +
 +    [FileName] =>sample.jpg 
 +    [FileDateTime] => 1503177453 
 + 
 + ( and so on ... 
 </code> </code>
 +** * Note: ** There is  a plugin that makes this even easier: [[http://piwigo.org/ext/extension_view.php?eid=829|read_metadata]]
  
-As you can seePhpWebGallery is very flexible. You can test //tools/sample.jpg// file for viewing all included metadata thanks to script //tools/metadata.php//.+As the output suggestscodes with # sign are IPTC field labels, the words between square [brackets] are Exif field labels, and the data after them are the corresponding content in your imageThese will be important for later.
  
-=== IPTC === 
  
-FIXME 
  
-==== Using metadata ==== 
  
-Among metadata, some can be copied into PhpWebGallery database. Once copied in database, they can be considered as **calculated data** : they are stored in database only for speed purpose (during searchmainly).+^   ** * WARNING! * **   ^ 
 +|  Changing this Piwigo behavior requires editing the configuration file:     **[your piwigo folder]/local/config/config.inc.php**  \\ Making a mistake here could cause your gallery to become inoperable, so do not modify your files directly. Instead, please refer to the article, [[user_documentation:use:features:conf_locale]], about making these changes safely using a plugin.    | 
 + 
 +=== Showing more metadata === 
 + 
 +**Exif** 
 + 
 +Piwigo already shows Exif metadata (by clicking the "Show file metadata" icon on a photo preview page) by default. You don't need to enable it. The core code that turns this on (or off) looks like this: 
 +<code>$conf['show_exif'] = true;</code> 
 +Some Exif fields are show by default. This is how it is configured in the core code: 
 +<code>$conf['show_exif_fields'] = array( 
 +  'Make', 
 +  'Model',  
 +  'DateTimeOriginal', 
 +  'COMPUTED;ApertureFNumber' 
 +  );</code> 
 +(to view the core code, click the 'Display reference file: "config_default.inc.php"' link at the top of the LocalFiles Editor plugin) 
 + 
 +To display //more// Exif fields, all you have to do is add their keys (which you obtained from the tool mentioned in this article) to the array in the plugin. Inserting the example code below into your config plugin, will add a few more camera settings: 
 +<code> 
 +$conf['show_exif_fields'] = array( 
 +  'DateTimeOriginal', 
 +  'Make', 
 +  'Model', 
 +  'ExposureProgram', 
 +  'FocalLengthIn35mmFilm', 
 +  'FNumber', 
 +  'ExposureTime', 
 +  'ISOSpeedRatings', 
 +  'Flash', 
 +  'WhiteBalance', 
 +  'UserComment' 
 +  ); 
 +</code> 
 + 
 +** IPTC ** 
 + 
 +Piwigo does **not** display any IPTC metadata by default. To enable it, add this code: 
 + 
 +<code>$conf['show_iptc'] = true;</code> 
 +Then you must choose which fields to display. Again, you need key names obtained earlier. Here is an example: 
 +<code> 
 +$conf['show_iptc_mapping'] = array( 
 +  'iptc_creator'         => '2#080', 
 +  'iptc_title'           => '2#005', 
 +  'iptc_headline'        => '2#105', 
 +  'iptc_description'     => '2#120', 
 +  'iptc_keywords'        => '2#025', 
 +  ); 
 +</code> 
 + 
 +=== Using your metadata to make Piwigo more powerful === 
 + 
 +([[user_documentation:use:features:conf_locale| Using the LocalFiles Editor]])\\ \\  
 +Using the method above has limitations. 'show_iptc' and 'show_exif' fetch metadata at the time when an image is displayed only. The metadata was not integrated into the Piwigo database, therefore it cannot be used for searching and other functions. For many people, //displaying// information such as focal length, shutter speed etc. is sufficient. However metadata such as keywords, titles etc. are very useful for other purposes, such as sorting and searching. This section describes how you can get more use from your IPTC metadata by adding it to the Piwigo database. 
 + 
 +Copying metadata into the Piwigo database takes place during the synchronisation stepIf you [[user_documentation:learn:add_picture|added images]] to Piwigo using the built-in web interface, this should happen automatically for you. However, there are many different ways to add images, and sometimes the Synchronization step is missed. You will then need to perform it manually. (Administration → Tools → Synchronise ] Also, the changes in this section will only affect images that are imported from that point in time forward. To extract metadata from previously imported images, you need to run the synchronisation step. 
 + 
 + 
 +** Exif ** 
 + 
 +Piwigo imports some Exif metadata by default. This is enabled by this code variable: 
 +<code>$conf['use_exif'] = true;</code> 
 +Next, the metadata is mapped. A mapping simply matches one key to another. The default code tells Piwigo to set an image's creation date in the database, to the value stored in the 'DateTimeOriginal' field in the Exif metadata. 
 +<code> $conf['use_exif_mapping'] = array('date_creation' => 'DateTimeOriginal' ); </code> 
 +This can be expanded by adding more mappings. (again, using Exif fields obtained earlier)\\  
 +\\ 
 +This example maps some comments (Just add this code to local files editor): 
 + 
 +<code> 
 +$conf['use_exif_mapping'] = array( 
 +  'date_creation'        => 'DateTimeOriginal', 
 +  'comment'              => 'UserComment', 
 +  ); 
 +</code> 
 + 
 +I may sometimes want to sort my photos according to the camera I used. For that we can write code to map the Exif Camera model field to Piwigo's unused 'tags' property. Then we can sort our images using this keyword with the built-in batch manager. Just add this mapping to the array above. 
 +  
 +<code> 
 +  'tags'                 => 'Model', 
 +</code> 
 +** IPTC **\\  
 +\\  
 +DefaultNot used.\\  
 +Enabling variable: 
 +<code>$conf['use_iptc'] = true;</code> 
 +\\ 
 +Example of extended mapping which imports IPTC metadata (often added using Adobe Lightroom) into corresponding Piwigo fields: 
 +<code> 
 +$conf['use_iptc_mapping'] = array( 
 +  'author'          => '2#080', 
 +  'name'            => '2#005', 
 +  'comment'         => '2#120', 
 +  'keywords'        => '2#025', 
 +  ); 
 +</code> 
 +\\ 
 +** * Tip: ** Using keywords is an //excellent// way to organise your photos, and even to create [[http://piwigo.org/ext/extension_view.php?eid=544|SmartAlbums]] (similar to LR's 'Smart Collection'). Keywords can be used for search filtering in the Batch Manager. If you already use keywords in Lightroom or other photo software suites, this mapping will make your life much easier. 
 +=== Limitations === 
 +There are limits to the metadata usage in Piwigo. There are only so many image properties in the standard Piwigo databaseand core code to use it. You can not map more than one metadata value to one Piwigo property. In other words, we can't use //all// IPTC or Exif metadata, because there is no place to put it.
  
-In branch 1.3, very few metadata were supported : filesize, width and height. With branch 1.4, EXIF and IPTC support is considerablely increasing the number of managed metadata. 
 
Back to top
user_documentation/metadata.1204325813.txt.gz · Last modified: 2009/03/07 22:13 (external edit)
 
 
github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact