⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 photoshop_file_info.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/******************************************************************************** Filename:     Photoshop_File_Info.php** Description:  Provides functions that mimic the way Photoshop reads and writes*               metadata in it's 'File Info' dialog** Author:       Evan Hunter** Date:         11/11/2004** Project:      JPEG Metadata** Revision:     1.11* Changes:      1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php** URL:          http://electronics.ozhiker.com** License:      This file is part of the PHP JPEG Metadata Toolkit.**               The PHP JPEG Metadata Toolkit is free software; you can*               redistribute it and/or modify it under the terms of the*               GNU General Public License as published by the Free Software*               Foundation; either version 2 of the License, or (at your*               option) any later version.**               The PHP JPEG Metadata Toolkit is distributed in the hope*               that it will be useful, but WITHOUT ANY WARRANTY; without*               even the implied warranty of MERCHANTABILITY or FITNESS*               FOR A PARTICULAR PURPOSE.  See the GNU General Public License*               for more details.**               You should have received a copy of the GNU General Public*               License along with the PHP JPEG Metadata Toolkit; if not,*               write to the Free Software Foundation, Inc., 59 Temple*               Place, Suite 330, Boston, MA  02111-1307  USA**               If you require a different license for commercial or other*               purposes, please contact the author: evan@ozhiker.com*******************************************************************************/// TODO: XMP sections: XAPMM, TIFF, EXIFinclude 'Toolkit_Version.php';          // Change: added as of version 1.11/******************************************************************************* Global Variable:      Software Name** Contents:     The string that is appended to fields which store the name of*               the software editor.*******************************************************************************/$GLOBALS[ "Software Name" ] = "(PHP JPEG Metadata Toolkit v" . $GLOBALS['Toolkit_Version'] . ")";          // Change:  Changed version numbers to reference Toolkit_Version.php - as of version 1.11/******************************************************************************* End of Global Variable:     Software Name******************************************************************************//******************************************************************************** Function:     get_photoshop_file_info** Description:  Retrieves Photoshop 'File Info' metadata in the same way that Photoshop*               does. The results are returned in an array as below:**               $file_info_array = array(*                       "title"                  => "",*                       "author"                 => "",*                       "authorsposition"        => "",      // Note: Not used in Photoshop 7 or higher*                       "caption"                => "",*                       "captionwriter"          => "",*                       "jobname"                => "",      // Note: Not used in Photoshop CS*                       "copyrightstatus"        => "",*                       "copyrightnotice"        => "",*                       "ownerurl"               => "",*                       "keywords"               => array( 0 => "", 1 => "", ... ),*                       "category"               => "",     // Note: Max 3 characters*                       "supplementalcategories" => array( 0 => "", 1 => "", ... ),*                       "date"                   => "",     // Note: DATE MUST BE IN YYYY-MM-DD format*                       "city"                   => "",*                       "state"                  => "",*                       "country"                => "",*                       "credit"                 => "",*                       "source"                 => "",*                       "headline"               => "",*                       "instructions"           => "",*                       "transmissionreference"  => "",*                       "urgency"                => "" );** Parameters:   Exif_array - an array containing the EXIF information to be*                            searched, as retrieved by get_EXIF_JPEG. (saves having to parse the EXIF again)*               XMP_array - an array containing the XMP information to be*                           searched, as retrieved by read_XMP_array_from_text. (saves having to parse the XMP again)*               IRB_array - an array containing the Photoshop IRB information*                           to be searched, as retrieved by get_Photoshop_IRB. (saves having to parse the IRB again)** Returns:      outputarray - an array as above, containing the Photoshop File Info data*******************************************************************************/function get_photoshop_file_info( $Exif_array, $XMP_array, $IRB_array ){        // Create a blank array to receive the output        $outputarray = array(                "title" => "",                "author" => "",                "authorsposition" => "",                "caption" => "",                "captionwriter" => "",                "jobname" => "",                "copyrightstatus" => "",                "copyrightnotice" => "",                "ownerurl" => "",                "keywords" => array(),                "category" => "",                "supplementalcategories" => array(),                "date" => "",                "city" => "",                "state" => "",                "country" => "",                "credit" => "",                "source" => "",                "headline" => "",                "instructions" => "",                "transmissionreference" => "",                "urgency" => "" );        /***************************************/        // XMP Processing        // Retrieve the dublin core section from the XMP header        // Extract the Dublin Core section from the XMP        $dublincore_block = find_XMP_block( $XMP_array, "dc" );        // Check that the Dublin Core section exists        if ( $dublincore_block != FALSE )        {                // Dublin Core Description Field contains caption                // Extract Description                $Item = find_XMP_item( $dublincore_block, "dc:description" );                // Check if Description Tag existed                if ( $Item != FALSE )                {                        // Ensure that the Description value exists and save it.                        if  ( ( array_key_exists( 'children', $Item ) ) &&                              ( $Item['children'][0]['tag'] == "rdf:Alt" ) &&                              ( array_key_exists( 'value', $Item['children'][0]['children'][0] ) ) )                        {                                $outputarray = add_to_field( $outputarray, 'caption' , HTML_UTF8_Escape( $Item['children'][0]['children'][0]['value'] ), "\n" );                        }                }                /***************************************/                // Dublin Core Creator Field contains author                // Extract Description                $Item = find_XMP_item( $dublincore_block, "dc:creator" );                // Check if Creator Tag existed                if ( $Item != FALSE )                {                        // Ensure that the Creator value exists and save it.                        if  ( ( array_key_exists( 'children', $Item ) ) &&                              ( $Item['children'][0]['tag'] =="rdf:Seq" ) &&                              ( array_key_exists( 'value', $Item['children'][0]['children'][0] ) ) )                        {                                $outputarray = add_to_field( $outputarray, 'author' , HTML_UTF8_Escape( $Item['children'][0]['children'][0]['value'] ), "\n" );                        }                }                /***************************************/                // Dublin Core Title Field contains title                // Extract Title                $Item = find_XMP_item( $dublincore_block, "dc:title" );                // Check if Title Tag existed                if ( $Item != FALSE )                {                        // Ensure that the Title value exists and save it.                        if  ( ( array_key_exists( 'children', $Item ) ) &&                              ( $Item['children'][0]['tag'] =="rdf:Alt" ) &&                              ( array_key_exists( 'value', $Item['children'][0]['children'][0] ) ) )                        {                                $outputarray = add_to_field( $outputarray, 'title' , HTML_UTF8_Escape( $Item['children'][0]['children'][0]['value'] ), "," );                        }                }                /***************************************/                // Dublin Core Rights Field contains copyrightnotice                // Extract Rights                $Item = find_XMP_item( $dublincore_block, "dc:rights" );                // Check if Rights Tag existed                if ( $Item != FALSE )                {                        // Ensure that the Rights value exists and save it.                        if  ( ( array_key_exists( 'children', $Item ) ) &&                              ( $Item['children'][0]['tag'] =="rdf:Alt" ) &&                              ( array_key_exists( 'value', $Item['children'][0]['children'][0] ) ) )                        {                                $outputarray = add_to_field( $outputarray, 'copyrightnotice' , HTML_UTF8_Escape( $Item['children'][0]['children'][0]['value'] ), "," );                        }                }                /***************************************/                // Dublin Core Subject Field contains keywords                // Extract Subject                $Item = find_XMP_item( $dublincore_block, "dc:subject" );                // Check if Subject Tag existed                if ( $Item != FALSE )                {                        // Ensure that the Subject values exist                        if  ( ( array_key_exists( 'children', $Item ) ) && ( $Item['children'][0]['tag'] =="rdf:Bag" ) )                        {                                // Cycle through each Subject value and save them                                foreach ( $Item['children'][0]['children'] as $keywords )                                {                                        if ( ! in_array ( HTML_UTF8_Escape( $keywords['value'] ), $outputarray['keywords']))                                        {                                                if  ( array_key_exists( 'value', $keywords ) )                                                {                                                        $outputarray['keywords'][] = HTML_UTF8_Escape( $keywords['value'] );                                                }                                        }                                }                        }                }        }        /***************************************/        // Find the Photoshop Information within the XMP block        $photoshop_block = find_XMP_block( $XMP_array, "photoshop" );        // Check that the Photoshop Information exists        if ( $photoshop_block != FALSE )        {                // The Photoshop CaptionWriter tag contains captionwriter - Find it                $Item = find_XMP_item( $photoshop_block, "photoshop:CaptionWriter" );                // Check that the CaptionWriter Field exists and save the value                if ( ( $Item != FALSE ) && ( array_key_exists( 'value', $Item ) ) )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -