Advertisement
fruffl

class IPTC-NAA IIM

Aug 8th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 36.99 KB | None | 0 0
  1. <?PHP
  2.  
  3.     CLASS ILLI_Container_Api_Image_Iptc
  4.     {
  5.         // http://www.iptc.org/site/Photo_Metadata/Overview/
  6.         // http://www.iptc.org/std/Iptc4xmpCore/1.0/specification/Iptc4xmpCore_1.0-spec-XMPSchema_8.pdf
  7.         // http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
  8.             const IPTC_RECORD_VERSION               = 0;
  9.             const IPTC_OBJECT_TYPE_REFERENCE            = 3;
  10.             const IPTC_OBJECT_ATTRIBUTE_REFERENCE       = 4;
  11.             const IPTC_OBJECT_NAME              = 5;
  12.             const IPTC_EDIT_STATUS              = 7;
  13.             const IPTC_EDITORIAL_UPDATE             = 8;
  14.             const IPTC_URGENCY                  = 10;
  15.             const IPTC_SUBJECT_REFERENCE            = 12;
  16.             const IPTC_CATEGORY                 = 15;
  17.             const IPTC_SUPPLEMENTAL_CATEGORY            = 20;
  18.             const IPTC_FIXTURE_IDENTIFIER           = 22;
  19.             const IPTC_KEYWORDS                 = 25;
  20.             const IPTC_CONTENT_LOCATION_CODE            = 26;
  21.             const IPTC_CONTENT_LOCATION_NAME            = 27;
  22.             const IPTC_RELEASE_DATE             = 30;
  23.             const IPTC_RELEASE_TIME             = 35;
  24.             const IPTC_EXPIRATION_DATE              = 37;
  25.             const IPTC_EXPIRATION_TIME              = 38;
  26.             const IPTC_SPECIAL_INSTRUCTIONS         = 40;
  27.             const IPTC_ACTION_ADVISED               = 42;
  28.             const IPTC_REFERENCE_SERVICE            = 45;
  29.             const IPTC_REFERENCE_DATE               = 47;
  30.             const IPTC_REFERENCE_NUMBER             = 50;
  31.             const IPTC_CREATED_DATE             = 55;
  32.             const IPTC_CREATED_TIME             = 60;
  33.             const IPTC_DIGITAL_CREATED_DATE         = 62;
  34.             const IPTC_DIGITAL_CREATED_TIME         = 63;
  35.             const IPTC_ORIGINATING_PROGRAM          = 65;
  36.             const IPTC_PROGRAM_VERSION              = 70;
  37.             const IPTC_OBJECT_CYCLE             = 75;
  38.             const IPTC_BYLINE                   = 80;
  39.             const IPTC_BYLINE_TITLE             = 85;
  40.             const IPTC_CITY                 = 90;
  41.             const IPTC_SUBLOCATION              = 92;
  42.             const IPTC_PROVINCE_STATE               = 95;
  43.             const IPTC_COUNTRY_CODE             = 100;
  44.             const IPTC_COUNTRY_NAME             = 101;
  45.             const IPTC_ORIGINAL_TRANSMISSION_REFERENCE      = 103;
  46.             const IPTC_HEADLINE                 = 105;
  47.             const IPTC_CREDIT                   = 110;
  48.             const IPTC_SOURCE                   = 115;
  49.             const IPTC_COPYRIGHT_NOTICE             = 116;
  50.             const IPTC_CONTACT                  = 118;
  51.             const IPTC_CAPTION                  = 120;
  52.             const IPTC_WRITER_EDITOR                = 122;
  53.             const IPTC_RASTERIZED_CAPTION           = 125;
  54.             const IPTC_IMAGE_TYPE               = 130;
  55.             const IPTC_IMAGE_ORIENTATION            = 131;
  56.             const IPTC_LANGUAGE_IDENT               = 135;
  57.             const IPTC_AUDIO_TYPE               = 150;
  58.             const IPTC_AUDIO_SAMPLING_RATE          = 151;
  59.             const IPTC_AUDIO_SAMPLING_RESOLUTION        = 152;
  60.             const IPTC_AUDIO_SAMPLING_DURATION          = 153;
  61.             const IPTC_AUDIO_SAMPLING_OUTCUE            = 154;
  62.             const IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT       = 200;
  63.             const IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_VERSION   = 201;
  64.             const IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_DATA  = 202;
  65.            
  66.             const RECORD = 2;
  67.            
  68.             private $metatable = array
  69.             (
  70.                 'version' => self::IPTC_RECORD_VERSION,
  71.                 'objecttypereference' => self::IPTC_OBJECT_TYPE_REFERENCE,
  72.                 'objectattributereference' => self::IPTC_OBJECT_ATTRIBUTE_REFERENCE,
  73.                 'objectname' => self::IPTC_OBJECT_NAME,
  74.                 'editstatus' => self::IPTC_EDIT_STATUS,
  75.                 'editorialupdate' => self::IPTC_EDITORIAL_UPDATE,
  76.                 'urgency' => self::IPTC_URGENCY,
  77.                 'subjectreference' => self::IPTC_SUBJECT_REFERENCE,
  78.                 'category' => self::IPTC_CATEGORY,
  79.                 'supplementalcategory' => self::IPTC_SUPPLEMENTAL_CATEGORY,
  80.                 'fixtureident' => self::IPTC_FIXTURE_IDENTIFIER,
  81.                 'keywords' => self::IPTC_KEYWORDS,
  82.                 'contentlocationcode' => self::IPTC_CONTENT_LOCATION_CODE,
  83.                 'contentlocationname' => self::IPTC_CONTENT_LOCATION_NAME,
  84.                 'releasedate' => self::IPTC_RELEASE_DATE,
  85.                 'releasetime' => self::IPTC_RELEASE_TIME,
  86.                 'expirationdate' => self::IPTC_EXPIRATION_DATE,
  87.                 'expirationtime' => self::IPTC_EXPIRATION_TIME,
  88.                 'specialinstructions' => self::IPTC_SPECIAL_INSTRUCTIONS,
  89.                 'actionadvised' => self::IPTC_ACTION_ADVISED,
  90.                 'referenceservice' => self::IPTC_REFERENCE_SERVICE,
  91.                 'referencedate' => self::IPTC_REFERENCE_DATE,
  92.                 'referencenumber' => self::IPTC_REFERENCE_NUMBER,
  93.                 'createddate' => self::IPTC_CREATED_DATE,
  94.                 'createdtime' => self::IPTC_CREATED_TIME,
  95.                 'digitalcreateddate' => self::IPTC_DIGITAL_CREATED_DATE,
  96.                 'digitalcreatedtime' => self::IPTC_DIGITAL_CREATED_TIME,
  97.                 'originatingprogram' => self::IPTC_ORIGINATING_PROGRAM,
  98.                 'programversion' => self::IPTC_PROGRAM_VERSION,
  99.                 'objectcycle' => self::IPTC_OBJECT_CYCLE,
  100.                 'byline' => self::IPTC_BYLINE,
  101.                 'bylinetitle' => self::IPTC_BYLINE_TITLE,
  102.                 'city' => self::IPTC_CITY,
  103.                 'sublocation' => self::IPTC_SUBLOCATION,
  104.                 'provincestate' => self::IPTC_PROVINCE_STATE,
  105.                 'countrycode' => self::IPTC_COUNTRY_CODE,
  106.                 'countryname' => self::IPTC_COUNTRY_NAME,
  107.                 'originaltransmissionreference' => self::IPTC_ORIGINAL_TRANSMISSION_REFERENCE,
  108.                 'headline' => self::IPTC_HEADLINE,
  109.                 'credit' => self::IPTC_CREDIT,
  110.                 'source' => self::IPTC_SOURCE,
  111.                 'copyrightnotice' => self::IPTC_COPYRIGHT_NOTICE,
  112.                 'contact' => self::IPTC_CONTACT,
  113.                 'caption' => self::IPTC_CAPTION,
  114.                 'writereditor' => self::IPTC_WRITER_EDITOR,
  115.                 'rasterizedcaption' => self::IPTC_RASTERIZED_CAPTION,
  116.                 'imagetype' => self::IPTC_IMAGE_TYPE,
  117.                 'imageorientation' => self::IPTC_IMAGE_ORIENTATION,
  118.                 'languageident' => self::IPTC_LANGUAGE_IDENT,
  119.                 'audiotype' => self::IPTC_AUDIO_TYPE,
  120.                 'audiosamplingrate' => self::IPTC_AUDIO_SAMPLING_RATE,
  121.                 'audiosamplingresolution' => self::IPTC_AUDIO_SAMPLING_RESOLUTION,
  122.                 'audiosamplingduration' => self::IPTC_AUDIO_SAMPLING_DURATION,
  123.                 'audiosamplingoutcue' => self::IPTC_AUDIO_SAMPLING_OUTCUE,
  124.                 'objectdatapreviewfileformat' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT,
  125.                 'objectdatapreviewfileversion' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_VERSION,
  126.                 'objectdatapreviewfiledata' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_DATA,
  127.             );
  128.            
  129.             private $path = NULL;
  130.             private $origmeta = array();
  131.             private $meta = array();
  132.             private $iptcmeta = '';
  133.            
  134.             public function __call($name, $value)
  135.             {
  136.                 if(substr($name, 0,4) !== 'set_')
  137.                     return $this;
  138.                
  139.                 $_name = strtolower(str_replace(substr($name, 0, 4), NULL, $name));
  140.                
  141.                 if(!array_key_exists($_name, $this->metatable))
  142.                     return $this;
  143.                    
  144.                 if(!isset($value[1]))
  145.                     $value[1] = self::RECORD;
  146.                    
  147.                 if(($value[1] = intval($value[1])) === 0)
  148.                     $value[1] = self::RECORD;
  149.                    
  150.                 $this->meta[$value[1].'#'.$this->metatable[$_name]] = $value[0];
  151.                
  152.                 return $this;
  153.             }
  154.            
  155.             public function save($path)
  156.             {
  157.                 if(FALSE === (bool) $this->meta)
  158.                     return $this;
  159.                    
  160.                 if(!function_exists('iptcembed'))
  161.                     return $this;
  162.                
  163.                 if(!file_exists($path))
  164.                     return $this;
  165.                    
  166.                 $this->path = $path;
  167.                
  168.                 //foreach($this->metatable as $tag => $tagtag)
  169.                 //  $this->{'set_'.$tag}(12);
  170.                
  171.                 //var_dump($this->meta);
  172.                
  173.                 $this->iptcmeta = '';
  174.                 foreach($this->meta as $tag => $string)
  175.                     //$this->iptcmeta .= $this->make_tag(str_pad(substr($tag, 2), 3, '0', STR_PAD_LEFT), $string, substr($tag, 0, 1));
  176.                     $this->iptcmeta .= $this->make_tag(substr($tag, 2), $string, substr($tag, 0, 1));
  177.                
  178.             $content = iptcembed($this->iptcmeta, $this->path);
  179.             file_put_contents($this->path, $content);
  180.            
  181.             //var_dump($this->read($this->path));
  182.             //die();
  183.             return $this;
  184.             }
  185.            
  186.             private function make_tag($data, $value, $record = self::RECORD)
  187.             {
  188.             $length = strlen($value);
  189.             $retval = chr(0x1C) . chr($record) . chr($data);
  190.            
  191.             if($length < 0x8000)
  192.             {
  193.                 $retval .= chr($length >> 8) .  chr($length & 0xFF);
  194.             }
  195.             else
  196.             {
  197.                 $retval .= chr(0x80) .
  198.                            chr(0x04) .
  199.                            chr(($length >> 24) & 0xFF) .
  200.                            chr(($length >> 16) & 0xFF) .
  201.                            chr(($length >> 8) & 0xFF) .
  202.                            chr($length & 0xFF);
  203.             }
  204.            
  205.             return $retval . $value;
  206.             }
  207.            
  208.             private function read($path)
  209.             {
  210.             if(!function_exists('iptcparse'))
  211.                 return $this;
  212.                
  213.                 if(!file_exists($path))
  214.                     return $this;
  215.                
  216.             $size = getimagesize($path, $info);
  217.            
  218.             if(!is_array($info))
  219.                 return $this;
  220.                
  221.             if(!array_key_exists('APP13', $info))
  222.                 return $this;
  223.                
  224.             $iptc = iptcparse($info['APP13']);
  225.             $_iptc = array();
  226.            
  227.             foreach($iptc as $data => $value)
  228.                 $_iptc[$data] = (is_array($value) ? implode('; ', $value) : $value);
  229.                    
  230.            
  231.             $this->origmeta = $_iptc;
  232.             return $_iptc;
  233.             }
  234.            
  235.             public function import($path)
  236.             {
  237.                 $orig = new self;
  238.                 $this->meta = $orig->read($path);
  239.                 return $this;
  240.             }
  241.            
  242.             public function test()
  243.             {
  244.                 /*
  245.                     http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
  246.                 */
  247.                
  248.                 /*
  249.                 2:00 Record Version
  250.                
  251.                     Mandatory, not repeatable, two octets.
  252.                     A binary number identifying the version of the Information
  253.                     Interchange Model, Part II (Record 2:xx), utilised by the provider.
  254.                     Version numbers are assigned by IPTC and NAA.
  255.                     The version number of this record is four (4).
  256.             */
  257.                 $this->set_version('4');
  258.                
  259.                 /*
  260.                 2:03 Object Type Reference
  261.                
  262.                     Not repeatable, 3-67 octets, consisting of 2 numeric characters
  263.                     followed by a colon and an optional text part of up to 64 octets.
  264.                     The Object Type is used to distinguish between different types
  265.                     of objects within the IIM.
  266.                    
  267.                     The first part is a number representing a language independent
  268.                     international reference to an Object Type followed by a colon
  269.                     separator.
  270.                    
  271.                     The second part, if used, is a text representation of the Object
  272.                     Type Number (maximum 64 octets) consisting of graphic
  273.                     characters plus spaces either in English, as defined in Appendix
  274.                     G, or in the language of the service as indicated in DataSet 2:135
  275.                    
  276.                     A list of Object Type Numbers and Names and their
  277.                     corresponding definitions will be maintained by the IPTC. See
  278.                     Appendix G.            
  279.                 */
  280.                 $this->set_objecttypereference('objecttypereference');
  281.                
  282.                 /*
  283.                     2:04 Object Attribute Reference
  284.                    
  285.                     Repeatable, 4-68 octets, consisting of 3 numeric characters
  286.                     followed by a colon and an optional text part of up to 64 octets.
  287.                     The Object Attribute defines the nature of the object
  288.                     independent of the Subject.
  289.                    
  290.                     The first part is a number representing a language independent
  291.                     international reference to an Object Attribute followed by a colon
  292.                     separator.
  293.                    
  294.                     The second part, if used, is a text representation of the Object
  295.                     Attribute Number ( maximum 64 octets) consisting of graphic
  296.                     characters plus spaces either in English, as defined in Appendix
  297.                     G, or in the language of the service as indicated in DataSet 2:135
  298.                    
  299.                     A registry of Object Attribute Numbers and Names and their
  300.                     corresponding definitions (if available) will be maintained by the
  301.                     IPTC in different languages, with translations as supplied by
  302.                     members. See Appendix G.
  303.                 */
  304.                 $this->set_objectattributereference('objectattributereference');
  305.                
  306.                 /*
  307.                 2:05 Object Name
  308.                
  309.                     Not repeatable, maximum 64 octets, consisting of graphic characters
  310.                     plus spaces.
  311.                    
  312.                     Used as a shorthand reference for the object. Changes to existing
  313.                     data, such as updated stories or new crops on photos,
  314.                     should be identified in Edit Status.
  315.                    
  316.                     Examples:
  317.                         "Wall St."
  318.                         "Ferry Sinks"              
  319.                 */
  320.                 $this->set_objectname('objectname');
  321.                
  322.                 /*
  323.                     2:07 Edit Status
  324.                
  325.                         Not repeatable. Maximum 64 octets, consisting of graphic
  326.                     characters plus spaces.
  327.                
  328.                     Status of the objectdata, according to the practice of the
  329.                     provider.
  330.                
  331.                     Examples:
  332.                         "Lead"
  333.                         "CORRECTION"
  334.                 */
  335.                 $this->set_editstatus('editstatus');
  336.                
  337.                 /*
  338.                 2:08 Editorial Update
  339.                
  340.                     Not repeatable, 2 octets, consisting of numeric characters.
  341.                     Indicates the type of update that this object provides to a
  342.                     previous object. The link to the previous object is made using
  343.                     the ARM (DataSets 1:120 and 1:122), according to the practices
  344.                     of the provider.
  345.                    
  346.                     Possible values:
  347.                         01 Additional language. Signifies that the accompanying
  348.                         Record 2 DataSets repeat information from another object
  349.                         in a different natural language (as indicated by DataSet
  350.                         2:135).            
  351.                 */
  352.                 $this->set_editorialupdate('editorialupdate');
  353.                
  354.                 /*
  355.                 2:10 Urgency
  356.                
  357.                     Not repeatable, one octet, consisting of a numeric character.
  358.                     Specifies the editorial urgency of content and not necessarily the
  359.                     envelope handling priority (see 1:60, Envelope Priority).
  360.                    
  361.                     The '1' is most urgent, '5' normal and '8' denotes the
  362.                     least-urgent copy.
  363.                    
  364.                     The numerals '9' and '0' are reserved for future use.              
  365.                 */
  366.                 $this->set_urgency('5');
  367.                
  368.                 /*
  369.                 2:12 Subject Reference
  370.                
  371.                     Repeatable. Minimum of 13 and maximum of 236 octets
  372.                     consisting of graphic characters. Colon ‘:’ is only allowed as
  373.                     specified, the asterisk ‘*’ and question mark ‘?’ are not allowed,
  374.                     nor are the octet values 42 and 63.
  375.                    
  376.                     The character encoding used for this dataset must encode the
  377.                     colon ':' using octet value 58, and must not use this octet value
  378.                     for any other purpose.
  379.                    
  380.                     The Subject Reference is a structured definition of the subject
  381.                     matter. It must contain an IPR (default value is "IPTC"), an 8
  382.                     digit Subject Reference Number and an optional Subject Name,
  383.                     Subject Matter Name and Subject Detail Name. Each part of the
  384.                     Subject reference is separated by a colon (:). The Subject
  385.                     Reference Number contains three parts, a 2 digit Subject
  386.                     Number, a 3 digit Subject Matter Number and a 3 digit Subject
  387.                     Detail Number thus providing unique identification of the
  388.                     object's subject.
  389.                    
  390.                     If the Subject Matter or Subject Detail is not defined then a value
  391.                     of 000 is used for the Subject Matter Number and/or Subject
  392.                     Detail Number as appropriate. (See Appendices H and I).
  393.                     The DataSet may be repeated when the objectdata content is
  394.                     relevant to several subjects of news interest. It can be
  395.                     independent of provider and for any media form. The provider
  396.                     must either use the IPTC scheme or one that has been defined
  397.                     and published by the provider.
  398.                    
  399.                     The construction of the Subject Reference is as follows:
  400.                    
  401.                         • Information Provider Reference (IPR)
  402.                             A name, registered with the IPTC/NAA, identifying the
  403.                             provider that provides an indicator of the SDR content.
  404.                             The default value for the IPR is "IPTC" and is mandatory if
  405.                             the Subject Reference exists in the IPTC coding
  406.                             scheme as displayed in Appendices H - J.
  407.                            
  408.                             Individual registered Information Providers may at their
  409.                             discretion extend the Subject Reference lists. However, they
  410.                             may only add to the subject matter and/or subject detail included
  411.                             in the IPTC lists, and must identify this by using their registered
  412.                             IPR.The IPTC Subject list may not be extended.
  413.                            
  414.                         • Subject Reference Number
  415.                             Provides a numeric code to indicate the Subject Name plus
  416.                             optional Subject Matter and Subject Detail Names in the
  417.                             language of the service. Subject Reference Numbers consist
  418.                             of 8 octets in the range 01000000 to 17999999 and
  419.                             represent a language independent international reference to
  420.                             a Subject. A Subject is identified by its Reference Number
  421.                             and corresponding Names taken from a standard lists given
  422.                             in Appendix H,I &J.These lists are the English language
  423.                             reference versions.
  424.  
  425.                         • Subject Name
  426.                             The third part, if used, is a text representation of the Subject
  427.                             Number (maximum 64 octets) consisting of graphic
  428.                             characters plus spaces either in English, as defined in
  429.                             Appendix H, or in the language of the service as indicated in
  430.                             DataSet 2:135
  431.                            
  432.                             The Subject identifies the general content of the objectdata
  433.                             as determined by the provider.
  434.                            
  435.                         • Subject Matter Name
  436.                             The fourth part, if used, is a text representation of the
  437.                             Subject Matter Number (maximum 64 octets) consisting of
  438.                             graphic characters plus spaces either in English, as defined
  439.                             in Appendix I, or in the language of the service as indicated
  440.                             in DataSet 2:135
  441.                            
  442.                             A Subject Matter further refines the Subject of a News
  443.                             Object.
  444.                            
  445.                         • Subject Detail Name
  446.                             The fifth part, if used, is a text representation of the Subject
  447.                             Detail Number (maximum 64 octets) consisting of graphic
  448.                             characters plus spaces either in English, as defined in
  449.                             Appendix J, or in the language of the service as indicated in
  450.                             DataSet 2:135
  451.                        
  452.                     A Subject Detail further refines the Subject Matter of a News
  453.                     Object. A registry of Subject Reference Numbers, Subject
  454.                     Matter Names and Subject Detail Names, descriptions (if
  455.                     available) and their corresponding parent Subjects will be held
  456.                     by the IPTC in different languages, with translations as supplied
  457.                     by members. See Appendices I and J.
  458.                 */
  459.                 $this->set_subjectreference('subjectreference');
  460.                
  461.                 /*
  462.                 2:15 Category
  463.                    
  464.                     Not repeatable, maximum three octets, consisting of alphabetic
  465.                     characters.
  466.                    
  467.                     Identifies the subject of the objectdata in the opinion of the
  468.                     provider.
  469.                    
  470.                     A list of categories will be maintained by a regional registry,
  471.                     where available, otherwise by the provider.
  472.                    
  473.                     Note: Use of this DataSet is Deprecated. It is likely that this
  474.                     DataSet will not be included in further versions of the IIM.               
  475.                 */
  476.                
  477.                 $this->set_category('category');
  478.  
  479.             /*
  480.                 2:20 Supplemental Category
  481.                
  482.                     Repeatable, maximum 32 octets, consisting of graphic characters
  483.                     plus spaces.
  484.                
  485.                     Supplemental categories further refine the subject of an
  486.                     objectdata. Only a single supplemental category may be
  487.                     contained in each DataSet. A supplemental category may include
  488.                     any of the recognised categories as used in 2:15. Otherwise,
  489.                     selection of supplemental categories are left to the
  490.                     provider.
  491.                    
  492.                     Examples:
  493.                         "NHL" (National Hockey League)
  494.                         "Fußball"
  495.                    
  496.                     Note: Use of this DataSet is Deprecated. It is likely that this
  497.                     DataSet will not be included in further versions of the IIM.
  498.             */             
  499.                 $this->set_supplementalcategory('category1 category2'); // ??
  500.                
  501.                 /*
  502.                     2:22 Fixture Identifier
  503.                    
  504.                     Not repeatable, maximum 32 octets, consisting of graphic characters.
  505.                     Identifies objectdata that recurs often and predictably. Enables
  506.                     users to immediately find or recall such an object.
  507.                
  508.                     Example:
  509.                         "EUROWEATHER"
  510.             */
  511.                 $this->set_fixtureident('fixtureident');
  512.                
  513.                 /*
  514.                 2:25 Keywords
  515.                
  516.                     Repeatable, maximum 64 octets, consisting of graphic characters
  517.                     plus spaces.
  518.                    
  519.                     Used to indicate specific information retrieval words.
  520.                     Each keyword uses a single Keywords DataSet. Multiple keywords
  521.                     use multiple Keywords DataSets.
  522.                    
  523.                     It is expected that a provider of various types of data that are related
  524.                     in subject matter uses the same keyword, enabling the receiving
  525.                     system or subsystems to search across all types of data
  526.                     for related material.
  527.                    
  528.                     Examples:
  529.                         "GRAND PRIX"
  530.                         "AUTO"             
  531.                 */
  532.                 $this->set_keywords('keyword1; keyword2');  // ??
  533.                
  534.                 /*
  535.                 2:26 Content Location Code
  536.                
  537.                     Repeatable, 3 octets consisting of alphabetic characters.
  538.                     Indicates the code of a country/geographical location referenced
  539.                     by the content of the object.
  540.                    
  541.                     Where ISO has established an appropriate country code under
  542.                     ISO 3166, that code will be used. When ISO3166 does not
  543.                     adequately provide for identification of a location or a country,
  544.                     e.g. ships at sea, space, IPTC will assign an appropriate threecharacter
  545.                     code under the provisions of ISO3166 to avoid
  546.                     conflicts. (see Appendix D) .
  547.                    
  548.                     If used in the same object with DataSet 2:27, must immediately
  549.                     precede and correspond to it.              
  550.                 */
  551.                 $this->set_contentlocationcode('contentlocationcode');
  552.                                
  553.                 /*
  554.                 2:27 Content Location Name
  555.                
  556.                     Repeatable, maximum 64 octets, consisting of graphic characters
  557.                     plus spaces.
  558.                    
  559.                     Provides a full, publishable name of a country/geographical
  560.                     location referenced by the content of the object, according to
  561.                     guidelines of the provider.
  562.                    
  563.                     If used in the same object with DataSet 2:26, must immediately
  564.                     follow and correspond to it.
  565.                 */             
  566.                 $this->set_contentlocationname('contentlocationname');
  567.                
  568.                 /*
  569.                 2:30 Release Date
  570.                
  571.                     Not repeatable, eight octets, consisting of numeric characters.
  572.                     Designates in the form CCYYMMDD the earliest date the
  573.                     provider intends the object to be used. Follows ISO 8601 standard.
  574.                    
  575.                     Example:
  576.                         "19890317" indicates data for release on 17 March 1989.            
  577.                 */
  578.                 $this->set_releasedate('20110101');
  579.                
  580.                 /*
  581.                 2:35 Release Time
  582.                
  583.                     Not repeatable, 11 octets, consisting of graphic characters.
  584.                     Designates in the form HHMMSS±HHMM the earliest time the
  585.                     provider intends the object to be used. Follows ISO 8601 standard.
  586.                    
  587.                     Example:
  588.                         "090000-0500" indicates object for use after
  589.                         0900 in New York (five hours behind UTC)               
  590.                 */
  591.                 $this->set_releasetime('060402+0100');
  592.                
  593.                 /*
  594.                 2:37 Expiration Date
  595.                
  596.                     Not repeatable, eight octets, consisting of numeric characters.
  597.                     Designates in the form CCYYMMDD the latest date the provider
  598.                     or owner intends the objectdata to be used. Follows ISO 8601
  599.                     standard.
  600.                    
  601.                     Example:
  602.                         “19940317” indicates an objectdata that should not be
  603.                         used after 17 March 1994.
  604.                 */
  605.                 $this->set_expirationdate('20111231');
  606.                
  607.                 /*
  608.                 2:38 Expiration Time
  609.                
  610.                     Not repeatable, 11 octets, consisting of graphic characters.
  611.                     Designates in the form HHMMSS±HHMM the latest time the
  612.                     provider or owner intends the objectdata to be used. Follows
  613.                     ISO 8601 standard.
  614.                
  615.                     Example:
  616.                         "090000-0500" indicates an objectdata that should not
  617.                         be used after 0900 in New York (five hours behind
  618.                         UTC).
  619.                
  620.                 Expiration date and time have uses beyond audio data. Weather
  621.                 forecasts, for example, typically carry expiration dates and times.            
  622.                 */
  623.                 $this->set_expirationtime('010203+0100');
  624.                
  625.                 /*
  626.                 2:40 Special Instructions
  627.                
  628.                     Not repeatable, maximum 256 octets, consisting of graphic characters
  629.                     plus spaces.
  630.                    
  631.                     Other editorial instructions concerning the use of the objectdata,
  632.                     such as embargoes and warnings.
  633.                    
  634.                     Examples:
  635.                         "SECOND OF FOUR STORIES"
  636.                         "3 Pictures follow"
  637.                         "Argentina OUT"            
  638.                 */
  639.                 $this->set_specialinstructions('specialinstructions');
  640.                
  641.                 /*
  642.                     2:42 Action Advised
  643.                    
  644.                         Not repeatable, 2 octets, consisting of numeric characters.
  645.                     Indicates the type of action that this object provides to a
  646.                     previous object. The link to the previous object is made using
  647.                     the ARM (DataSets 1:120 and 1:122), according to the practices
  648.                     of the provider.
  649.                    
  650.                     Possible values:   
  651.                         01 Object Kill.
  652.                             Signifies that the provider wishes the holder of
  653.                             a copy of the referenced object make no further use of
  654.                             that information and take steps to prevent further
  655.                             distribution thereof. Implies that any use of the object
  656.                             might result in embarrassment or other exposure of the
  657.                             provider and/or recipient.
  658.                         02 Object Replace.
  659.                             Signifies that the provider wants to
  660.                             replace the referenced object with the object provided
  661.                             under the current envelope.                    
  662.                         03 Object Append.
  663.                             Signifies that the provider wants to
  664.                             append to the referenced object information provided in
  665.                             the objectdata of the current envelope.
  666.                         04 Object Reference.
  667.                             Signifies that the provider wants to
  668.                             make reference to objectdata in a different envelope.
  669.                    
  670.             */
  671.                 $this->set_actionadvised('02');
  672.                
  673.                 /*
  674.                 Note:
  675.                     The following DataSets 2:45, 2:47 and 2:50, when repeated, will be repeated
  676.                     together, i.e. in sequential triplets.
  677.             */
  678.            
  679.             /*
  680.                 2:45 Reference Service
  681.                     Optional, repeatable, format identical with 1:30.
  682.                     Identifies the Service Identifier of a prior envelope to which the
  683.                     current object refers.
  684.                    
  685.                     Must be followed by 2:47 and 2:50 with repetition occurring in
  686.                     sequential triplets. Used together, 2:45, 2:47 and 2:50 indicate
  687.                     that the current object refers to the content of a prior envelope.
  688.             */
  689.                 $this->set_referenceservice('referenceservice');
  690.                
  691.                 /*
  692.                 2:47 Reference Date
  693.                
  694.                     Mandatory if 2:45 exists and otherwise not allowed. Repeatable,
  695.                     format identical with 1:70
  696.                    
  697.                     Identifies the date of a prior envelope to which the current
  698.                     object refers.             
  699.                 */
  700.                 $this->set_referencedate('20100101');
  701.                
  702.                 /*
  703.                 2:50 Reference Number
  704.                
  705.                     Mandatory if 2:45 exists and otherwise not allowed. Repeatable,
  706.                     format identical with 1:40.
  707.                    
  708.                     Identifies the Envelope Number of a prior envelope to which the
  709.                     current object refers.
  710.                 */
  711.                 $this->set_referencenumber('referencenumber');
  712.                
  713.                 /*
  714.                 2:55 Date Created
  715.                     Not repeatable, eight octets, consisting of numeric characters.
  716.                     Represented in the form CCYYMMDD to designate the date the
  717.                     intellectual content of the objectdata was created rather than the
  718.                     date of the creation of the physical representation. Follows ISO
  719.                     8601 standard. Where the month or day cannot be determined,
  720.                     the information will be represented by “00”. Where the year
  721.                     cannot be determined, the information for century and year will
  722.                     be represented by “00”.
  723.                    
  724.                     Thus a photo taken during the American Civil War would carry a
  725.                     creation date during that epoch (1861-1865) rather than the date
  726.                     the photo was digitised for archiving.
  727.                    
  728.                     Example:
  729.                         "19900127" indicates the intellectual content created on
  730.                         27th January 1990.             
  731.                 */
  732.                 $this->set_createddate('20100202');
  733.                
  734.                 /*
  735.                 2:60 Time Created
  736.                     Not repeatable, 11 octets, consisting of graphic characters.
  737.                     Represented in the form HHMMSS±HHMM to designate the
  738.                     time the intellectual content of the objectdata current source
  739.                     material was created rather than the creation of the physical
  740.                     representation. Follows ISO 8601 standard.
  741.                    
  742.                     Where the time cannot be precisely determined, the closest
  743.                     approximation should be used.
  744.                    
  745.                     Example:
  746.                         "133015+0100" indicates that the object intellectual
  747.                         content was created at 1:30 p.m. and 15 seconds Frankfurt
  748.                         time, one hour ahead of UTC.               
  749.                 */
  750.                 $this->set_createdtime('060402+0100');
  751.                
  752.                 /*
  753.                 2:62 Digital Creation Date
  754.                
  755.                     Not repeatable, eight octets, consisting of numeric characters.
  756.                     Represented in the form CCYYMMDD to designate the date the
  757.                     digital representation of the objectdata was created. Follows ISO
  758.                     8601 standard. Thus a photo taken during the American Civil
  759.                     War would carry a Digital Creation Date within the past several
  760.                     years rather than the date where the image was captured on
  761.                     film, glass plate or other substrate during that epoch (1861-
  762.                     1865).
  763.                    
  764.                     Example:
  765.                         "19900127" indicates digital form of the objectdata was
  766.                         created on 27th January 1990.              
  767.                 */
  768.                 $this->set_digitalcreateddate('20090202');
  769.                
  770.                 /*
  771.                 2:63 Digital Creation Time
  772.                     Not repeatable, 11 octets, consisting of graphic characters.
  773.                     Represented in the form HHMMSS±HHMM to designate the
  774.                     time the digital representation of the objectdata was created.
  775.                     Follows ISO 8601 standard.
  776.                    
  777.                     Example:
  778.                         "133015+0100" indicates that the digital form of the
  779.                         objectdata was created at 1:30 p.m. and 15 seconds
  780.                         Frankfurt time, one hour ahead of UTC.             
  781.                 */
  782.                 $this->set_digitalcreatedtime('060402+0100');
  783.                
  784.                 /*
  785.                 2:65 Originating Program
  786.                
  787.                     Not repeatable, maximum of 32 octets, consisting of graphic
  788.                     characters plus spaces.
  789.                    
  790.                     Identifies the type of program used to originate the objectdata.
  791.                    
  792.                     Examples:
  793.                         "Word Perfect"
  794.                         "SCITEX"
  795.                         "MacDraw"
  796.                 */
  797.                 $this->set_originatingprogram('ILLI');
  798.                
  799.                 /*
  800.                 2:70 Program Version
  801.                
  802.                     Not repeatable, maximum of 10 octets, consisting of graphic
  803.                     characters plus spaces.
  804.                
  805.                     Used to identify the version of the program mentioned in 2:65.
  806.                     DataSet 2:70 is invalid if 2:65 is not present.            
  807.                 */
  808.                 $this->set_programversion('5.2');
  809.                
  810.                 /*
  811.                 2:75 Object Cycle
  812.                
  813.                     Not repeatable, one octet, consisting of an alphabetic character.
  814.                    
  815.                     Where:
  816.                         'a' = morning
  817.                         'p' = evening
  818.                         'b' = both
  819.                    
  820.                     Virtually only used in North America.
  821.             */             
  822.                 $this->set_objectcycle('b');
  823.                
  824.                 /*
  825.                 2:80 By-line
  826.                    
  827.                     Repeatable, maximum 32 octets, consisting of graphic characters
  828.                     plus spaces.
  829.                    
  830.                     Contains name of the creator of the objectdata, e.g. writer, photographer
  831.                     or graphic artist.
  832.                    
  833.                     Examples:
  834.                         "Robert Capa"
  835.                         "Ernest Hemingway"
  836.                         "Pablo Picasso"
  837.             */             
  838.                 $this->set_byline('byline');
  839.                
  840.                 /*
  841.                 2:85 By-line Title
  842.                
  843.                     Repeatable, maximum 32 octets, consisting of graphic characters
  844.                     plus spaces.
  845.                
  846.                     A by-line title is the title of the creator or creators of an
  847.                     objectdata. Where used, a by-line title should follow the by-line it
  848.                     modifies.
  849.                
  850.                     Examples:
  851.                         "Staff Photographer"
  852.                         "Corresponsal"
  853.                         "Envoyé Spécial"             
  854.                 */
  855.                 $this->set_bylinetitle('bylinetitle');
  856.                
  857.                 /*
  858.                 2:90 City
  859.                
  860.                     Not repeatable, maximum 32 octets, consisting of graphic characters
  861.                     plus spaces.
  862.                    
  863.                     Identifies city of objectdata origin according to guidelines established
  864.                     by the provider.
  865.                    
  866.                     Examples:
  867.                         "Zürich"
  868.                         "Milano"
  869.                         "New York"             
  870.                 */
  871.                 $this->set_city('city');
  872.                 /*
  873.                 2:92 Sublocation
  874.                     Not repeatable, maximum 32 octets, consisting of graphic
  875.                     characters plus spaces.
  876.                    
  877.                     Identifies the location within a city from which the objectdata
  878.                     originates, according to guidelines established by the provider.
  879.                    
  880.                     Examples:
  881.                         "Capitol Hill"
  882.                         "Maple Leaf Gardens"
  883.                         "Strandgateparken"             
  884.                 */
  885.                 $this->set_sublocation('sublocation');
  886.                
  887.                 /*
  888.                 2:95 Province/State
  889.                
  890.                     Not repeatable, maximum 32 octets, consisting of graphic characters
  891.                     plus spaces.
  892.                    
  893.                     Identifies Province/State of origin according to guidelines
  894.                     established by the provider.
  895.                    
  896.                     Examples:
  897.                         "WA"
  898.                         "Sussex"
  899.                         "Baden-Württenberg"               
  900.                 */
  901.                 $this->set_provincestate('provincestate');
  902.                
  903.                 /*
  904.                 2:100 Country/Primary Location Code
  905.                
  906.                     Not repeatable, three octets consisting of alphabetic characters.
  907.                     Indicates the code of the country/primary location where the
  908.                     intellectual property of the objectdata was created, e.g. a photo
  909.                     was taken, an event occurred.
  910.                
  911.                     Where ISO has established an appropriate country code under
  912.                     ISO 3166, that code will be used. When ISO3166 does not
  913.                     adequately provide for identification of a location or a new
  914.                     country, e.g. ships at sea, space, IPTC will assign an
  915.                     appropriate three-character code under the provisions of
  916.                     ISO3166 to avoid conflicts. (see Appendix D)
  917.                
  918.                     Examples:
  919.                         "USA" (United States)
  920.                         "FRA" (France)
  921.                         “XUN” (United Nations)
  922.             */
  923.                 $this->set_countrycode('BEL');
  924.                
  925.                 /*
  926.                 2:101 Country/ Primary Location Name
  927.                
  928.                     Not repeatable, maximum 64 octets, consisting of graphic
  929.                     characters plus spaces.
  930.                
  931.                     Provides full, publishable, name of the country/primary location
  932.                     where the intellectual property of the objectdata was created,
  933.                     according to guidelines of the provider.
  934.                 */
  935.                 $this->set_countryname('countryname');
  936.                
  937.                 /*
  938.                     2:103 Original Transmission Reference
  939.                    
  940.                     Not repeatable. Maximum 32 octets, consisting of graphic characters
  941.                     plus spaces.
  942.                    
  943.                     A code representing the location of original transmission according
  944.                     to practices of the provider.
  945.                    
  946.                     Examples:
  947.                         BER-5
  948.                         PAR-12-11-01
  949.             */
  950.                 $this->set_originaltransmissionreference('originaltransmissionreference');
  951.                
  952.                 /*
  953.                     2:105 Headline
  954.                         Not repeatable, maximum of 256 octets, consisting of graphic
  955.                     characters plus spaces.
  956.                    
  957.                     A publishable entry providing a synopsis of the contents of the
  958.                     objectdata.
  959.                    
  960.                     Example:
  961.                         "Lindbergh Lands In Paris"
  962.                 */
  963.                 $this->set_headline('headline');
  964.                
  965.                 /*
  966.                 2:110 Credit
  967.                
  968.                     Not repeatable, maximum of 32 octets, consisting of graphic
  969.                     characters plus spaces.
  970.  
  971.                     Identifies the provider of the objectdata, not necessarily the
  972.                     owner/creator.
  973.                 */
  974.                 $this->set_credit('All rights reserved.');
  975.                
  976.                 /*
  977.                 2:115 Source
  978.                
  979.                     Not repeatable, maximum of 32 octets, consisting of graphic
  980.                     characters plus spaces.
  981.                    
  982.                     Identifies the original owner of the intellectual content of the
  983.                     objectdata. This could be an agency, a member of an agency or
  984.                     an individual.
  985.                 */
  986.                 $this->set_source('source');
  987.                
  988.                 /*
  989.                 2:116 Copyright Notice
  990.                
  991.                     Not repeatable, maximum of 128 octets, consisting of graphic
  992.                     characters plus spaces.
  993.                    
  994.                     Contains any necessary copyright notice.
  995.                 */
  996.                 $this->set_copyrightnotice('copyrightnotice');
  997.                
  998.             /*
  999.                 2:118 Contact
  1000.            
  1001.                     Repeatable, maximum of 128 octets, consisting of graphic
  1002.                     characters plus spaces.
  1003.                    
  1004.                     Identifies the person or organisation which can provide further
  1005.                     background information on the objectdata.
  1006.             */
  1007.                 $this->set_contact('contact');
  1008.                
  1009.                 /*
  1010.                 2:120 Caption/Abstract
  1011.                    
  1012.                     Not repeatable, maximum of 2000 octets, consisting of graphic
  1013.                     characters plus carriage-returns, linefeeds and spaces.
  1014.                    
  1015.                     A textual description of the objectdata, particularly used where
  1016.                     the object is not text.
  1017.                 */
  1018.                 $this->set_caption('caption');
  1019.                
  1020.                 /*
  1021.                 2:122 Writer/Editor
  1022.                
  1023.                     Repeatable, maximum 32 octets, consisting of graphic characters
  1024.                     plus spaces.
  1025.                
  1026.                     Identification of the name of the person involved in the writing,
  1027.                     editing or correcting the objectdata or caption/abstract.
  1028.                 */
  1029.                 $this->set_writereditor('~lvm');
  1030.  
  1031.             /*
  1032.                 2:131 Image Orientation
  1033.                
  1034.                     Not repeatable, one octet, consisting of an alphabetic
  1035.                     character. Allowed values are P (for Portrait), L (for Landscape)
  1036.                     and S (for Square).
  1037.                    
  1038.                     Indicates the layout of the image area.
  1039.             */
  1040.                 $this->set_imageorientation('L');
  1041.                
  1042.                 /*
  1043.                 2:135 Language Identifier
  1044.                
  1045.                     Not repeatable, two or three octets, consisting of alphabetic
  1046.                     characters.
  1047.                 */
  1048.                 $this->set_languageident('nl');
  1049.                
  1050.                
  1051.                 return $this;
  1052.                 /*
  1053.                 'audiotype' => self::IPTC_AUDIO_TYPE,
  1054.                 'audiosamplingrate' => self::IPTC_AUDIO_SAMPLING_RATE,
  1055.                 'audiosamplingresolution' => self::IPTC_AUDIO_SAMPLING_RESOLUTION,
  1056.                 'audiosamplingduration' => self::IPTC_AUDIO_SAMPLING_DURATION,
  1057.                 'audiosamplingoutcue' => self::IPTC_AUDIO_SAMPLING_OUTCUE,
  1058.                 'objectdatapreviewfileformat' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT,
  1059.                 'objectdatapreviewfileversion' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_VERSION,
  1060.                 'objectdatapreviewfiledata' => self::IPTC_OBJECTDATA_PREVIEW_FILE_FORMAT_DATA,
  1061.                 */
  1062.             }
  1063.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement