本文整理汇总了PHP中get_jpeg_header_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_jpeg_header_data函数的具体用法?PHP get_jpeg_header_data怎么用?PHP get_jpeg_header_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_jpeg_header_data函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getImageMetadata
function getImageMetadata($event)
{
$medium = $event->getArgument('medium');
$data = array('headers' => null, 'exif' => null, 'xmp' => null, 'irb' => null, 'finfo' => null);
$ext = $medium->getExtension();
$file = $medium->getAbsPath();
if (zmgFactory::getConfig()->get('plugins/jpeg_metadata/general/readwrite') && ($ext == "jpg" || $ext == "jpeg") && !ZMG_SAFEMODE_ON) {
//import libs first (duh ;) )
$jmt_dir = "v" . str_replace('.', '_', ZMG_JMT_VERSION);
zmgimport('org.zoomfactory.var.plugins.jpeg_metadata.' . $jmt_dir . '.EXIF');
//takes care of some deferred loading as well
zmgimport('org.zoomfactory.var.plugins.jpeg_metadata.' . $jmt_dir . '.Photoshop_File_Info');
// Retreive the EXIF, XMP and Photoshop IRB information from
// the existing file, so that it can be updated later on...
$data['headers'] = get_jpeg_header_data($file);
$data['exif'] = get_EXIF_JPEG($file);
$data['xmp'] = read_XMP_array_from_text(get_XMP_text($data['headers']));
$data['irb'] = get_Photoshop_IRB($data['headers']);
$data['finfo'] = get_photoshop_file_info($data['exif'], $data['xmp'], $data['irb']);
// Check if there is a default for the date defined
if (!array_key_exists('date', $data['finfo']) || array_key_exists('date', $data['finfo']) && $data['finfo']['date'] == '') {
// No default for the date defined
// figure out a default from the file
// Check if there is a EXIF Tag 36867 "Date and Time of Original"
if ($data['exif'] != false && array_key_exists(0, $data['exif']) && array_key_exists(34665, $data['exif'][0]) && array_key_exists(0, $data['exif'][0][34665]) && array_key_exists(36867, $data['exif'][0][34665][0])) {
// Tag "Date and Time of Original" found - use it for the default date
$data['finfo']['date'] = $data['exif'][0][34665][0][36867]['Data'][0];
$data['finfo']['date'] = preg_replace("/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/", "\$1-\$2-\$3", $data['finfo']['date']);
} elseif ($data['exif'] != false && array_key_exists(0, $data['exif']) && array_key_exists(34665, $data['exif'][0]) && array_key_exists(0, $data['exif'][0][34665]) && array_key_exists(36868, $data['exif'][0][34665][0])) {
// Check if there is a EXIF Tag 36868 "Date and Time when Digitized"
// Tag "Date and Time when Digitized" found - use it for the default date
$data['finfo']['date'] = $data['exif'][0][34665][0][36868]['Data'][0];
$data['finfo']['date'] = preg_replace("/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/", "\$1-\$2-\$3", $data['finfo']['date']);
} else {
if ($data['exif'] != false && array_key_exists(0, $data['exif']) && array_key_exists(306, $data['exif'][0])) {
// Check if there is a EXIF Tag 306 "Date and Time"
// Tag "Date and Time" found - use it for the default date
$data['finfo']['date'] = $data['exif'][0][306]['Data'][0];
$data['finfo']['date'] = preg_replace("/(\\d\\d\\d\\d):(\\d\\d):(\\d\\d)( \\d\\d:\\d\\d:\\d\\d)/", "\$1-\$2-\$3", $data['finfo']['date']);
} else {
// Couldn't find an EXIF date in the image
// Set default date as creation date of file
$data['finfo']['date'] = date("Y-m-d", filectime($file));
}
}
}
}
return zmgJpeg_metadataPlugin::interpretImageData($data, $medium->filename);
}
开发者ID:BGCX261,项目名称:zoom-gallery-svn-to-git,代码行数:49,代码来源:jpeg_metadataPlugin.php
示例2: write_copy_protection
function write_copy_protection($outputfilename, $copystatus)
{
$new_ps_file_info_array = array('title' => "", 'author' => "Hamsterpaj.net", 'authorsposition' => "", 'caption' => "", 'captionwriter' => $_SESSION['login']['id'], 'jobname' => "", 'copyrightstatus' => $copystatus, 'copyrightnotice' => "", 'ownerurl' => "", 'keywords' => array(), 'category' => "", 'supplementalcategories' => array(), 'date' => date("Y-m-d"), 'city' => "", 'state' => "", 'country' => "", 'credit' => "", 'source' => "", 'headline' => "", 'instructions' => "", 'transmissionreference' => "", 'urgency' => "");
foreach ($new_ps_file_info_array as $var_key => $var_val) {
$new_ps_file_info_array[$var_key] = stripslashes($var_val);
}
// Keywords should be an array - explode it on newline boundarys
$new_ps_file_info_array['keywords'] = explode("\n", trim($new_ps_file_info_array['keywords']));
// Supplemental Categories should be an array - explode it on newline boundarys
$new_ps_file_info_array['supplementalcategories'] = explode("\n", trim($new_ps_file_info_array['supplementalcategories']));
// Protect against hackers editing other files
$path_parts = pathinfo($outputfilename);
if (strcasecmp($path_parts["extension"], "jpg") != 0) {
return "Incorrect File Type - JPEG Only\n";
exit;
}
// Change: removed limitation on file being in current directory - as of version 1.11
// Retrieve the header information
$jpeg_header_data = get_jpeg_header_data($outputfilename);
// Update the JPEG header information with the new Photoshop File Info
$jpeg_header_data = put_photoshop_file_info($jpeg_header_data, $new_ps_file_info_array);
// Check if the Update worked
if ($jpeg_header_data == FALSE) {
// Update of file info didn't work - output error message
return "Error - Failure update File Info : {$outputfilenam} <br>\n";
exit;
}
// Attempt to write the new JPEG file
if (FALSE == put_jpeg_header_data($outputfilename, $outputfilename, $jpeg_header_data)) {
// Writing of the new file didn't work - output error message
return "Error - Failure to write new JPEG : {$filename} <br>\n";
// Abort processing
exit;
}
//return "<p><a href=\"Edit_File_Info_Example.php?jpeg_fname=$outputfilename\" >View Full Metatdata Information</a></p>\n";
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:36,代码来源:exif.php
示例3: mime_image_get_exif_data
/**
* mime_image_get_exif_data fetch meta data from uploaded image
*
* @param array $pUpload uploaded file data
* @access public
* @return array filled with exif goodies
*/
function mime_image_get_exif_data($pUpload)
{
$exifHash = array();
if (function_exists('exif_read_data') && !empty($pUpload['source_file']) && is_file($pUpload['source_file']) && preg_match("#/(jpe?g|tiff)#i", $pUpload['type'])) {
// exif_read_data can be noisy due to crappy files, e.g. "Incorrect APP1 Exif Identifier Code" etc...
$exifHash = @exif_read_data($pUpload['source_file'], 0, TRUE);
// extract more information if we can find it
if (ini_get('short_open_tag')) {
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/JPEG.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/JFIF.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/PictureInfo.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/XMP.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/EXIF.php';
// Retrieve the header information from the JPEG file
$jpeg_header_data = get_jpeg_header_data($pUpload['source_file']);
// Retrieve EXIF information from the JPEG file
$Exif_array = get_EXIF_JPEG($pUpload['source_file']);
// Retrieve XMP information from the JPEG file
$XMP_array = read_XMP_array_from_text(get_XMP_text($jpeg_header_data));
// Retrieve Photoshop IRB information from the JPEG file
$IRB_array = get_Photoshop_IRB($jpeg_header_data);
if (!empty($exifHash['IFD0']['Software']) && preg_match('/photoshop/i', $exifHash['IFD0']['Software'])) {
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/Photoshop_File_Info.php';
// Retrieve Photoshop File Info from the three previous arrays
$psFileInfo = get_photoshop_file_info($Exif_array, $XMP_array, $IRB_array);
if (!empty($psFileInfo['headline'])) {
$exifHash['headline'] = $psFileInfo['headline'];
}
if (!empty($psFileInfo['caption'])) {
$exifHash['caption'] = $psFileInfo['caption'];
}
}
}
// only makes sense to store the GPS data if we at least have latitude and longitude
if (!empty($exifHash['GPS'])) {
// store GPS coordinates as deg decimal float
$gpsConv = array('GPSLatitude', 'GPSDestLatitude', 'GPSLongitude', 'GPSDestLongitude');
foreach ($gpsConv as $conv) {
if (!empty($exifHash['GPS'][$conv]) && is_array($exifHash['GPS'][$conv])) {
$exifHash['GPS'][$conv] = mime_image_convert_exifgps($exifHash['GPS'][$conv]);
}
}
}
}
return $exifHash;
}
开发者ID:kailIII,项目名称:liberty,代码行数:53,代码来源:mime.image.php
示例4: get_jpeg_header_data
* ************************************************************************* */
include 'Toolkit_Version.php';
// Change: added as of version 1.11
// Check for operation modes 2 or 3
// i.e. $filename is defined, and $new_ps_file_info_array is not
if (!isset($new_ps_file_info_array) && isset($filename) && is_string($filename)) {
// Hide any unknown EXIF tags
$GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE;
// Accessing the existing file info for the specified file requires these includes
include 'JPEG.php';
include 'XMP.php';
include 'Photoshop_IRB.php';
include 'EXIF.php';
include 'Photoshop_File_Info.php';
// Retrieve the header information from the JPEG file
$jpeg_header_data = get_jpeg_header_data($filename);
// Retrieve EXIF information from the JPEG file
$Exif_array = get_EXIF_JPEG($filename);
// Retrieve XMP information from the JPEG file
$XMP_array = read_XMP_array_from_text(get_XMP_text($jpeg_header_data));
// Retrieve Photoshop IRB information from the JPEG file
$IRB_array = get_Photoshop_IRB($jpeg_header_data);
// Retrieve Photoshop File Info from the three previous arrays
$new_ps_file_info_array = get_photoshop_file_info($Exif_array, $XMP_array, $IRB_array);
// Check if there is an array of defaults available
if (isset($default_ps_file_info_array) && is_array($default_ps_file_info_array)) {
// There are defaults defined
// Check if there is a default for the date defined
if (!array_key_exists('date', $default_ps_file_info_array) || array_key_exists('date', $default_ps_file_info_array) && $default_ps_file_info_array['date'] == '') {
// No default for the date defined
// figure out a default from the file
开发者ID:cyberorca,项目名称:dfp-api,代码行数:31,代码来源:Edit_File_Info.php
示例5: extractMetaData
/**
* extractMetaData extract meta data from images
*
* @param array $pParamHash
* @param array $pFile
* @access public
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
* @deprecated deprecated since version 2.1.0-beta
*/
function extractMetaData(&$pParamHash, &$pFile)
{
//deprecated( "This method has been replaced by a method in LibertyMime. Please try to migrate your code." );
// Process a JPEG , jpeg_metadata_tk REQUIRES short_tags because that is the way it was written. feel free to fix something. XOXO spiderr
if (ini_get('short_open_tag') && function_exists('exif_read_data') && !empty($pFile['tmp_name']) && strpos(strtolower($pFile['type']), 'jpeg') !== FALSE) {
$exifHash = @exif_read_data($pFile['tmp_name'], 0, true);
// Change: Allow this example file to be easily relocatable - as of version 1.11
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/JPEG.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/JFIF.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/PictureInfo.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/XMP.php';
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/EXIF.php';
// Retrieve the header information from the JPEG file
$jpeg_header_data = get_jpeg_header_data($pFile['tmp_name']);
// Retrieve EXIF information from the JPEG file
$Exif_array = get_EXIF_JPEG($pFile['tmp_name']);
// Retrieve XMP information from the JPEG file
$XMP_array = read_XMP_array_from_text(get_XMP_text($jpeg_header_data));
// Retrieve Photoshop IRB information from the JPEG file
$IRB_array = get_Photoshop_IRB($jpeg_header_data);
if (!empty($exifHash['IFD0']['Software']) && preg_match('/photoshop/i', $exifHash['IFD0']['Software'])) {
require_once UTIL_PKG_PATH . 'jpeg_metadata_tk/Photoshop_File_Info.php';
// Retrieve Photoshop File Info from the three previous arrays
$psFileInfo = get_photoshop_file_info($Exif_array, $XMP_array, $IRB_array);
if (!empty($psFileInfo['headline'])) {
if (empty($pParamHash['title'])) {
$pParamHash['title'] = $psFileInfo['headline'];
} elseif (empty($pParamHash['edit']) && !$this->getField('data') && $pParamHash['title'] != $psFileInfo['headline']) {
$pParamHash['edit'] = $psFileInfo['headline'];
}
}
if (!empty($psFileInfo['caption'])) {
if (empty($pParamHash['title'])) {
$pParamHash['title'] = $psFileInfo['caption'];
} elseif (empty($pParamHash['edit']) && !$this->getField('data') && $pParamHash['title'] != $psFileInfo['caption']) {
$pParamHash['edit'] = $psFileInfo['caption'];
}
}
}
if (!empty($exifHash['EXIF']['DateTimeOriginal'])) {
$pParamHash['event_time'] = strtotime($exifHash['EXIF']['DateTimeOriginal']);
}
if (!empty($exifHash['IFD0']['ImageDescription'])) {
if (empty($pParamHash['title'])) {
$pParamHash['title'] = $exifHash['IFD0']['ImageDescription'];
} elseif (empty($pParamHash['edit']) && !$this->getField('data') && $pParamHash['title'] != $exifHash['IFD0']['ImageDescription']) {
$pParamHash['edit'] = $exifHash['IFD0']['ImageDescription'];
}
}
}
}
开发者ID:kailIII,项目名称:liberty,代码行数:60,代码来源:LibertyAttachable.php
示例6: processImage
/**
* Make a newly uploaded medium ready for use in the gallery.
*
* @param string $image
* @param string $filename
* @param string $filetype
* @param string $keywords
* @param string $name
* @param string $descr
* @param int $rotate
* @param int $degrees
* @param int $ignoresizes
* @return boolean
* @access public
*/
function processImage($image, $filename, $filetype, $keywords, $name, $descr, $rotate, $degrees = 0, $ignoresizes = 0)
{
global $mosConfig_absolute_path, $zoom;
// reset script execution time limit (as set in MAX_EXECUTION_TIME ini directive)...
// requires SAFE MODE to be OFF!
if (ini_get('safe_mode') != 1) {
set_time_limit(0);
}
$imagepath = $zoom->_CONFIG['imagepath'];
$catdir = $zoom->_gallery->getDir();
$filename = urldecode($filename);
// replace every space-character with a single "_"
$filename = ereg_replace(" ", "_", $filename);
$filename = stripslashes($filename);
$filename = ereg_replace("'", "_", $filename);
// Get rid of extra underscores
$filename = ereg_replace("_+", "_", $filename);
$filename = ereg_replace("(^_|_\$)", "", $filename);
$zoom->checkDuplicate($filename, 'filename');
$filename = $zoom->_tempname;
// replace space-characters in combination with a comma with 'air'...or nothing!
$keywords = $zoom->cleanString($keywords);
//$keywords = $zoom->htmlnumericentities($keywords);
$name = $zoom->cleanString($name);
//$name = $zoom->htmlnumericentities($name);
//$descr = $zoom->cleanString($descr);
//$descr = $zoom->htmlnumericentities($descr);
if (empty($name)) {
$name = $zoom->_CONFIG['tempName'];
}
$imgobj = new image(0);
//create a new image object with a foo imgid
$imgobj->setImgInfo($filename, $name, $keywords, $descr, $zoom->_gallery->_id, $zoom->currUID, 1, 1);
$imgobj->getMimeType($filetype, $image);
unset($filename, $name, $keywords, $descr);
//clear memory, just in case...
if (!$zoom->acceptableSize($image)) {
// the file is simply too big, register this...
$this->_err_num++;
$this->_err_names[$this->_err_num] = $imgobj->_filename;
$this->_err_types[$this->_err_num] = sprintf(_ZOOM_ALERT_TOOBIG, $zoom->_CONFIG['maxsizekb'] . 'kB');
return false;
}
/* IMPORTANT CHEATSHEET:
* If we don't get useful data from that or its a type we don't
* recognize, take a swing at it using the file name.
if ($mimeType == 'application/octet-stream' ||
$mimeType == 'application/unknown' ||
GalleryCoreApi::convertMimeToExtension($mimeType) == null) {
$extension = GalleryUtilities::getFileExtension($file['name']);
$mimeType = GalleryCoreApi::convertExtensionToMime($extension);
}
*/
if ($zoom->acceptableFormat($imgobj->getMimeType(), true)) {
// File is an image/ movie/ document...
$file = "{$mosConfig_absolute_path}/{$imagepath}{$catdir}/" . $imgobj->_filename;
$desfile = "{$mosConfig_absolute_path}/{$imagepath}{$catdir}/thumbs/" . $imgobj->_filename;
if (is_uploaded_file($image)) {
if (!move_uploaded_file("{$image}", $file)) {
// some error occured while moving file, register this...
$this->_err_num++;
$this->_err_names[$this->_err_num] = $imgobj->_filename;
$this->_err_types[$this->_err_num] = _ZOOM_ALERT_MOVEFAILURE;
return false;
}
} elseif (!$zoom->platform->copy("{$image}", $file) && !$zoom->platform->file_exists($file)) {
// some error occured while moving file, register this...
$this->_err_num++;
$this->_err_names[$this->_err_num] = $imgobj->_filename;
$this->_err_types[$this->_err_num] = _ZOOM_ALERT_MOVEFAILURE;
return false;
}
@$zoom->platform->chmod($file, '0777');
$viewsize = $mosConfig_absolute_path . "/" . $imagepath . $catdir . "/viewsize/" . $imgobj->_filename;
if ($zoom->acceptableFormat($imgobj->getMimeType(), true)) {
if ($zoom->isImage($imgobj->getMimeType(), true)) {
$imgobj->_size = $zoom->platform->getimagesize($file);
// get image EXIF & IPTC data from file to save it in viewsize image and get a thumbnail...
if ($zoom->_CONFIG['readEXIF'] && ($imgobj->_type === "jpg" || $imgobj->_type === "jpeg") && !(bool) ini_get('safe_mode')) {
// Retreive the EXIF, XMP and Photoshop IRB information from
// the existing file, so that it can be updated later on...
$jpeg_header_data = get_jpeg_header_data($file);
$EXIF_data = get_EXIF_JPEG($file);
$XMP_data = read_XMP_array_from_text(get_XMP_text($jpeg_header_data));
$IRB_data = get_Photoshop_IRB($jpeg_header_data);
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zoom-gallery-svn-to-git,代码行数:101,代码来源:toolbox.class.php
示例7: get_Meta_JPEG
function get_Meta_JPEG($filename)
{
// Change: Added as of version 1.11
// Check if a wrapper is being used - these are not currently supported (see notes at top of file)
if (stristr($filename, "http://") != FALSE || stristr($filename, "ftp://") != FALSE) {
// A HTTP or FTP wrapper is being used - show a warning and abort
echo "HTTP and FTP wrappers are currently not supported with Meta - See EXIF/Meta functionality documentation - a local file must be specified<br>";
echo "To work on an internet file, copy it locally to start with:<br><br>\n";
echo "\$newfilename = tempnam ( \$dir, \"tmpmeta\" );<br>\n";
echo "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
return FALSE;
}
// get the JPEG headers
$jpeg_header_data = get_jpeg_header_data($filename);
// Flag that an Meta segment has not been found yet
$Meta_Location = -1;
//Cycle through the header segments
for ($i = 0; $i < count($jpeg_header_data); $i++) {
// If we find an APP3 header,
if (strcmp($jpeg_header_data[$i]['SegName'], "APP3") == 0) {
// And if it has the Meta label,
if (strncmp($jpeg_header_data[$i]['SegData'], "Meta", 6) == 0 || strncmp($jpeg_header_data[$i]['SegData'], "META", 6) == 0) {
// Save the location of the Meta segment
$Meta_Location = $i;
}
}
}
// Check if an EXIF segment was found
if ($Meta_Location == -1) {
// Couldn't find any Meta block to decode
return FALSE;
}
$filehnd = @fopen($filename, 'rb');
// Check if the file opened successfully
if (!$filehnd) {
// Could't open the file - exit
echo "<p>Could not open file {$filename}</p>\n";
return FALSE;
}
fseek($filehnd, $jpeg_header_data[$Meta_Location]['SegDataStart'] + 6);
// Decode the Meta segment into an array and return it
$meta = process_TIFF_Header($filehnd, "Meta");
// Close File
fclose($filehnd);
return $meta;
}
开发者ID:evanhunter,项目名称:PJMT,代码行数:46,代码来源:EXIF.php
示例8: setJpegComment
static function setJpegComment($fname, $comment)
{
require_once 'jpeg-toolkit/JPEG.php';
$headers = get_jpeg_header_data($fname);
$headers = put_jpeg_Comment($headers, $comment);
put_jpeg_header_data($fname, $fname, $headers);
}
开发者ID:NatWeiss,项目名称:JankyPHP,代码行数:7,代码来源:img.php
示例9: getSingleAssetRecordList
//.........这里部分代码省略.........
if ($matchedId == false) {
$this->addError("Part " . $ivaluesArray[1]->getText() . " does not exist.");
if (isset($log)) {
$item = new AgentNodeEntryItem("ExifImporter Error", "Part " . $ivaluesArray[1] . " does not exist.");
$log->appendLogWithTypes($item, $formatType, $priorityType);
}
return false;
}
$partStructuresArray[] = $matchedId;
$repeatableValueArray = array();
foreach ($ivaluesArray as $ivalueField) {
if ($ivalueField->nodeName == "value") {
$valueArray = array();
$ivaluesChildren = $ivalueField->childNodes;
foreach ($ivaluesChildren as $ivalue) {
if ($ivalue->nodeName == "exifElement") {
$valueArray[] = "exif::" . $ivalue->getText();
}
if ($ivalue->nodeName == "text") {
$valueArray[] = "text::" . $ivalue->getText();
}
}
$repeatableValueArray[] = $valueArray;
}
}
$valuesPreFinal[$matchedId->getIdString()] = $repeatableValueArray;
}
$this->_valuesFinal[$matchedSchema->getIdString()] = $valuesPreFinal;
}
$this->_partsFinal[$matchedSchema->getIdString()] = $partStructuresArray;
}
}
}
$recordList = array();
$recordListElement = array();
$headerData = get_jpeg_header_data($input);
$fileMetaData1 = $this->extractPhotoshopMetaData();
$fileMetaData2 = $this->extractExifMetaData($input);
$fileMetaData = array_merge($fileMetaData1, $fileMetaData2);
$recordListElement['structureId'] = $this->_fileStructureId;
$recordListElement['partStructureIds'] = $this->_fileNamePartIds;
$recordListElement['parts'] = array($input, "");
$recordList[] = $recordListElement;
$recordListElement = array();
foreach ($this->_structureId as $structureId) {
$parts = array();
$recordListElement['structureId'] = $structureId;
$recordListElement['partStructureIds'] = $this->_partsFinal[$structureId->getIdString()];
$partValuesArray = $this->_valuesFinal[$structureId->getIdString()];
foreach ($partValuesArray as $key => $repeatablePartsArray) {
$partValues = array();
foreach ($repeatablePartsArray as $partsComponentsArray) {
// If we have a single entry in the value field, create
// multiple part values for any repeated source values.
if (count($partsComponentsArray) == 1) {
$checkExifField = explode("::", $partsComponentsArray[0]);
// An Exif Value
if ($checkExifField[0] == "exif") {
if (isset($fileMetaData[$checkExifField[1]])) {
//multi-valued source values
if (is_array($fileMetaData[$checkExifField[1]])) {
foreach ($fileMetaData[$checkExifField[1]] as $sourceValue) {
$partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $sourceValue);
}
} else {
$partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $fileMetaData[$checkExifField[1]]);
}
}
} else {
$partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $checkExifField[1]);
}
} else {
$data = "";
foreach ($partsComponentsArray as $partComponent) {
$checkExifField = explode("::", $partComponent);
// An Exif Value
if ($checkExifField[0] == "exif") {
if (isset($fileMetaData[$checkExifField[1]])) {
if (is_array($fileMetaData[$checkExifField[1]])) {
$data .= implode(", ", $fileMetaData[$checkExifField[1]]);
} else {
$data .= $fileMetaData[$checkExifField[1]];
}
}
} else {
$data .= $checkExifField[1];
}
}
$partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $data);
}
}
$parts[] = $partValues;
}
$recordListElement['parts'] = $parts;
$recordList[] = $recordListElement;
}
// printpre($recordList);
// exit;
return $recordList;
}
开发者ID:adamfranco,项目名称:polyphony,代码行数:101,代码来源:ExifRepositoryImporter.class.php
示例10: get_jpeg_Comment
if (!$couleur) {
$couleur = $this->GetParameter('pointcolor');
}
// Taille point par défaut : 10
$point_size = $this->GetParameter('pointsize');
if (!$point_size) {
$point_size = 10;
}
// parametre centrage point
$centrage = $this->GetParameter('pointcenter');
if ($centrage == '') {
$centrage = 1;
}
// Fin lecture Parametre de l'action
// Lecture commentaires embarqués dans la page
$comment_jpeg = get_jpeg_Comment(get_jpeg_header_data('tools/cartowiki/images/' . $src_map));
// Solution facile de lecture, mais difficile à maintenir : notamment la notation
parse_str($comment_jpeg);
// Fuseau 31T :
// Rappel : Pixel : O,0 en haut gauche
// X Coin inferieur gauche en Pixel
//$Px_echelle_X1['31T']=0;
$Px_echelle_X1['31T'] = $X131T;
// Y Coin inferieur gauche en Pixel
//$Px_echelle_Y1['31T']=539;
$Px_echelle_Y1['31T'] = $Y131T;
// Pour calcul Resolution
// X Coin inferieur droit en Pixel
//$Px_echelle_X2['31T']=805;
$Px_echelle_X2['31T'] = $X231T;
// Y Coin inferieur droit en Pixel
开发者ID:BackupTheBerlios,项目名称:wikiplug,代码行数:31,代码来源:mapview.php
示例11: metadata_image
/**
* function to update image metadata
*/
function metadata_image($metadata_conf)
{
if (is_array($metadata_conf) && count($metadata_conf) > 0) {
include_once 'metadata/Toolkit_Version.php';
error_reporting(0);
include_once 'metadata/JPEG.php';
include_once 'metadata/XMP.php';
include_once 'metadata/Photoshop_IRB.php';
include_once 'metadata/EXIF.php';
include_once 'metadata/Photoshop_File_Info.php';
// Copy all of the HTML Posted variables into an array
//$new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS'];
$new_ps_file_info_array = $metadata_conf;
$filename = $new_ps_file_info_array['filename'];
//echo $filename;
// Protect against hackers editing other files
$path_parts = pathinfo($filename);
$array_extention = array('png', 'jpg');
if (strcasecmp($path_parts["extension"], "jpg") != 0) {
//if (!in_array($path_parts["extension"], $array_extention))
#echo "Incorrect File Type - JPEG Only\n";
return array('status' => 'failed', 'message' => 'Incorrect File Type - JPEG Only');
exit;
}
// Change: removed limitation on file being in current directory - as of version 1.11
// Retrieve the header information
$jpeg_header_data = get_jpeg_header_data($filename);
// Retreive the EXIF, XMP and Photoshop IRB information from
// the existing file, so that it can be updated
$Exif_array = get_EXIF_JPEG($filename);
$XMP_array = read_XMP_array_from_text(get_XMP_text($jpeg_header_data));
$IRB_array = get_Photoshop_IRB($jpeg_header_data);
// Update the JPEG header information with the new Photoshop File Info
$jpeg_header_data = put_photoshop_file_info($jpeg_header_data, $new_ps_file_info_array, $Exif_array, $XMP_array, $IRB_array);
// Check if the Update worked
if ($jpeg_header_data == FALSE) {
//echo '$jpeg_header_data false';
return array('status' => 'failed', 'message' => 'Error - Failure update Photoshop File Info : ' . $filename);
// Abort processing
exit;
}
// Attempt to write the new JPEG file
if (FALSE == put_jpeg_header_data($filename, $filename, $jpeg_header_data)) {
//echo 'put_jpeg_header_data false';
return array('status' => 'failed', 'message' => 'Error - Failure to write new JPEG : ' . $filename);
// Abort processing
exit;
}
return array('status' => 'succes', 'message' => $filename . ' updated');
}
}
开发者ID:cyberorca,项目名称:dfp-api,代码行数:54,代码来源:upload.php
示例12: process
/**
* performs the service processing
*
* @param string Content which should be processed.
* @param string Content type
* @param array Configuration array
* @return boolean
*/
function process($content = '', $type = '', $conf = array())
{
$this->conf = $conf;
$this->out = array();
if ($content) {
$this->setInput($content, $type);
}
if ($inputFile = $this->getInputFile() and $jpeg_header_data = get_jpeg_header_data($inputFile)) {
$this->xmpRaw = get_XMP_text($jpeg_header_data);
preg_match('#<x:xmpmeta[^>]*>.*</x:xmpmeta>#is', $this->xmpRaw, $match);
$this->xmpRaw = $match[0];
$this->xmp = parseXMP2simpleArray(read_XMP_array_from_text($this->xmpRaw));
foreach ($this->xmp as $key => $value) {
// ignore empty lines headers and emtpy entries
if ($value) {
switch (strtolower($key)) {
case 'dc:creator':
$this->out['fields']['creator'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'dc:description':
$this->out['fields']['description'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'dc:rights':
$this->out['fields']['copyright'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'dc:subject':
$this->out['fields']['keywords'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'dc:title':
$this->out['fields']['title'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'iptc4xmpcore:countrycode':
if (strlen($value) == 2) {
$select = 'cn_iso_3';
$table = 'static_countries';
$where = tx_staticinfotables_div::getIsoCodeField($table, $value) . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(strtoupper($value), 'static_countries');
$where .= t3lib_BEfunc::deleteClause($table);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$this->out['fields']['loc_country'] = $row['cn_iso_3'];
}
}
break;
case 'iptc4xmpcore:location':
$value = trim($value);
if ($value[0] == '/' or $value[0] == '\\') {
$this->out['fields']['file_orig_location'] = tx_svmetaextract_lib::forceUtf8($value);
} else {
$this->out['fields']['loc_desc'] = tx_svmetaextract_lib::forceUtf8($value);
}
break;
case 'xmp:createdate':
$this->out['fields']['date_cr'] = tx_svmetaextract_lib::parseDate($value);
break;
case 'xmp:creatortool':
$this->out['fields']['file_creator'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'xmp:modifydate':
$this->out['fields']['date_mod'] = tx_svmetaextract_lib::parseDate($value);
break;
case 'xap:createdate':
$this->out['fields']['date_cr'] = tx_svmetaextract_lib::parseDate($value);
break;
case 'xap:creatortool':
$this->out['fields']['file_creator'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'xap:modifydate':
$this->out['fields']['date_mod'] = tx_svmetaextract_lib::parseDate($value);
break;
case 'xaprights:copyright':
$this->out['fields']['copyright'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'xaprights:usageterms':
$this->out['fields']['instructions'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'xmptpg:npages':
$this->out['fields']['pages'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'pdf:keywords':
$this->out['fields']['keywords'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'pdf:producer':
$this->out['fields']['file_creator'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'photoshop:captionwriter':
$this->out['fields']['photoshop:captionwriter'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'photoshop:city':
$this->out['fields']['loc_city'] = tx_svmetaextract_lib::forceUtf8($value);
break;
case 'photoshop:credit':
$this->out['fields']['copyright'] = tx_svmetaextract_lib::forceUtf8($value);
//.........这里部分代码省略.........
开发者ID:plan2net,项目名称:svmetaextract,代码行数:101,代码来源:class.tx_svmetaextract_sv6.php
示例13: get_Meta_JPEG
function get_Meta_JPEG($filename)
{
// get the JPEG headers
$jpeg_header_data = get_jpeg_header_data($filename);
// Flag that an Meta segment has not been found yet
$Meta_Location = -1;
//Cycle through the header segments
for ($i = 0; $i < count($jpeg_header_data); $i++) {
// If we find an APP3 header,
if (strcmp($jpeg_header_data[$i]['SegName'], "APP3") == 0) {
// And if it has the Meta label,
if (strncmp($jpeg_header_data[$i]['SegData'], "Meta", 6) == 0 || strncmp($jpeg_header_data[$i]['SegData'], "META", 6) == 0) {
// Save the location of the Meta segment
$Meta_Location = $i;
}
}
}
// Check if an EXIF segment was found
if ($Meta_Location == -1) {
// Couldn't find any Meta block to decode
return FALSE;
}
$filehnd = @fopen($filename, 'rb');
// Check if the file opened successfully
if (!$filehnd) {
// Could't open the file - exit
echo "<p>Could not open file {$filename}</p>\n";
return FALSE;
}
fseek($filehnd, $jpeg_header_data[$Meta_Location]['SegDataStart'] + 6);
// Decode the Meta segment into an array and return it
$meta = process_TIFF_Header($filehnd, "Meta");
// Close File
fclose($filehnd);
return $meta;
}
开发者ID:BGCX261,项目名称:zoom-gallery-svn-to-git,代码行数:36,代码来源:EXIF.php
注:本文中的get_jpeg_header_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论