Advertisement
fruffl

class Api_Image_Iptc

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