定制 cnlpete/image-metadata-parser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cnlpete/image-metadata-parser

最新稳定版本:v0.0.6

Composer 安装命令:

composer require cnlpete/image-metadata-parser

包简介

An abstraction to Exif, ITPC and XMP

README 文档

README

Hi! Image-Metadata-Parser is a set of php function which try to simplify the access to some imagefiles metadata (exif, itpc or xmp).

Usage

To use Image-Metadata-Parser, you simply need to place the class somewhere accessible within your application.

Then you can create a new ParserObject with some imagefile and read its metadata.

<?php
include('inc/imageMetadataParser.php');

$imageparser = new ImageMetadataParser('path/to/imagefile.jpg');
if (!$imageparser->parseExif())
  echo "Parsing of Exif Data failed";
if (!$imageparser->parseIPTC())
  echo "Parsing of IPTC failed";

Get the title

if ($imageparser->hasTitle())
  echo "Image Title: " . $imageparser->getTitle();

get the date and time

if ($imageparser->hasDateTime())
  echo "Image Taken At: " . date('r', $imageparser->getDateTime());

get a thumbnail

if ($imageparser->hasThumbnail()) {
  echo "<img src='data:" . 
      $imageparser->getThumbnailContentType() .
      ";base64," .
      base64_encode( $imageparser->getThumbnail() ) .
      "' />";
}

check the orientation

if ($imageparser->hasOrientation())
  if ($imageparser->getOrientation() === 0)
    echo "Image is oriented properly.<br />\n";
  else
    echo "Image needs to be rotated with imagerotate(image, " . $imageparser->getOrientation() . ", 0);<br />\n";

get the gps coordinates

if ($imageparser->hasGPS()) {
  $dLat = 0; $dLong = 0;
  $imageparser->getGPS($dLat, $dLong);
  echo "approximate GPS position: " .
      "<a href='https://maps.google.com/maps?q=" . $dLat . "," . $dLong . "'>Lat: " . $dLat . " Long: " . $dLong . "</a>";
}

Hope you find it useful! :)

统计信息

  • 总下载量: 3.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 33
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 33
  • Watchers: 5
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-18