public function defaultValueIfNotFound() { $this->assertNull(IptcData::fromFile($this->resourceAsFile('exif-only.jpg'), NULL)); }
static function __static() { self::$EMPTY = new self(); }
/** * Returns an IptcData instance or NULL if this image does not contain * IPTC Data * * @return img.util.IptcData */ public function iptcData() { if (!($seg = $this->segmentsOf('img.io.IptcSegment'))) { return NULL; } with($data = new IptcData(), $iptc = $seg[0]->rawData()); // Parse creation date if (3 == sscanf(@$iptc['2#055'][0], '%4d%2d%d', $year, $month, $day)) { $created = Date::create($year, $month, $day, 0, 0, 0); } else { $created = NULL; } $data->setTitle(@$iptc['2#005'][0]); $data->setUrgency(@$iptc['2#010'][0]); $data->setCategory(@$iptc['2#015'][0]); $data->setSupplementalCategories(@$iptc['2#020']); $data->setKeywords(@$iptc['2#025']); $data->setSpecialInstructions(@$iptc['2#040'][0]); $data->setDateCreated($created); $data->setAuthor(@$iptc['2#080'][0]); $data->setAuthorPosition(@$iptc['2#085'][0]); $data->setCity(@$iptc['2#090'][0]); $data->setState(@$iptc['2#095'][0]); $data->setCountry(@$iptc['2#101'][0]); $data->setOriginalTransmissionReference(@$iptc['2#103'][0]); $data->setHeadline(@$iptc['2#105'][0]); $data->setCredit(@$iptc['2#110'][0]); $data->setSource(@$iptc['2#115'][0]); $data->setCopyrightNotice(@$iptc['2#116'][0]); $data->setCaption(@$iptc['2#120'][0]); $data->setWriter(@$iptc['2#122'][0]); return $data; }