I think that data is in IPTC
block.
So try this one:
<?php
$size = getimagesize('leaf.jpg', $info );
//var_dump($info);die;
var_dump(iptcparse($info['APP13']));
more detailed examples You can find in comments
in this official doc: http://php.net/manual/en/function.iptcparse.php
IPTC headers are:
<?php
DEFINE('IPTC_OBJECT_NAME', '2#005');
DEFINE('IPTC_EDIT_STATUS', '2#007');
DEFINE('IPTC_PRIORITY', '2#010');
DEFINE('IPTC_CATEGORY', '2#015');
DEFINE('IPTC_SUPPLEMENTAL_CATEGORY', '2#020');
DEFINE('IPTC_FIXTURE_IDENTIFIER', '2#022');
DEFINE('IPTC_KEYWORDS', '2#025');
DEFINE('IPTC_RELEASE_DATE', '2#030');
DEFINE('IPTC_RELEASE_TIME', '2#035');
DEFINE('IPTC_SPECIAL_INSTRUCTIONS', '2#040');
DEFINE('IPTC_REFERENCE_SERVICE', '2#045');
DEFINE('IPTC_REFERENCE_DATE', '2#047');
DEFINE('IPTC_REFERENCE_NUMBER', '2#050');
DEFINE('IPTC_CREATED_DATE', '2#055');
DEFINE('IPTC_CREATED_TIME', '2#060');
DEFINE('IPTC_ORIGINATING_PROGRAM', '2#065');
DEFINE('IPTC_PROGRAM_VERSION', '2#070');
DEFINE('IPTC_OBJECT_CYCLE', '2#075');
DEFINE('IPTC_BYLINE', '2#080');
DEFINE('IPTC_BYLINE_TITLE', '2#085');
DEFINE('IPTC_CITY', '2#090');
DEFINE('IPTC_PROVINCE_STATE', '2#095');
DEFINE('IPTC_COUNTRY_CODE', '2#100');
DEFINE('IPTC_COUNTRY', '2#101');
DEFINE('IPTC_ORIGINAL_TRANSMISSION_REFERENCE', '2#103');
DEFINE('IPTC_HEADLINE', '2#105');
DEFINE('IPTC_CREDIT', '2#110');
DEFINE('IPTC_SOURCE', '2#115');
DEFINE('IPTC_COPYRIGHT_STRING', '2#116');
DEFINE('IPTC_CAPTION', '2#120');
DEFINE('IPTC_LOCAL_CAPTION', '2#121');
and here is Your class to work with IPTC OOP way (:
class IPTCData {
const KEYWORDS_HEADER = '2#025';
const TITLE_HEADER = '2#005';
const DESCRIPTION_HEADER = '2#120';
private $file;
private $info;
private $data = [];
public function __construct($file) {
$tgis->file = $file;
getimagesize($file, $this->info);
if(isset($info['APP13'])) {
$this->data = $info['APP13'];
}
}
public function getFile() {
return $this->file;
}
public function getInfo() {
return $this->info;
}
public function getIPTCData($key = null) {
if($key) {
return isset($this->data[$key])
? $this->data[$key] : null;
}
return $this->data;
}
private function pickOneFromData($key) {
$data = $this->getIPTCData($key);
return (is_array($data) && !empty($data))
? $data[0] : null;
}
public function getKeywords() {
return $this->getIPTCData(self::KEYWORDS_HEADER);
}
public function getTitle() {
return $this->pickOneFromData(self::TITLE_HEADER);
}
public function getDescription() {
return $this->pickOneFromData(self::DESCRIPTION_HEADER);
}
public function getAll() {
$title = $this->getTitle();
$descriptions = $this->getDescription();
$keywords = $this->getKeywords();
return compact('title', 'descriptions', 'keywords');
}
}
usage:
$file = 'leaf.jpg';
$iptcData = new IPTCData($file);
$title = $iptcData->getTitle();
$descriptions = $iptcData->getDescription();
$keywords = $iptcData->getKeywords();
or to use with DB ORMs (for example: Eloquent):
$file = 'leaf.jpg';
$iptcData = new IPTCData($file);
$ImageInfo = new ImageInfo($iptcData->getAll());
$ImageInfo->save();
P.S. feel free to extend my class with necessary for You functions