[Linpha-cvs] SF.net SVN: linpha: [4679] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-02-15 11:18:26
|
Revision: 4679 http://svn.sourceforge.net/linpha/?rev=4679&view=rev Author: bzrudi Date: 2007-02-15 03:18:24 -0800 (Thu, 15 Feb 2007) Log Message: ----------- code cleanups and some minor fixes to the MetaData stuff Modified Paths: -------------- trunk/linpha2/admin/metadata.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/templates/default/fragments.php Added Paths: ----------- trunk/linpha2/lib/include/metadata_info_edit.php trunk/linpha2/lib/include/metadata_info_show.php Removed Paths: ------------- trunk/linpha2/lib/include/File_Info_Edit.php trunk/linpha2/lib/include/File_Info_Show.php Modified: trunk/linpha2/admin/metadata.php =================================================================== --- trunk/linpha2/admin/metadata.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/admin/metadata.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,4 +1,31 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program 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. +* +* This program 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 this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * @package admin + * @subpackage MetaData + * + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + if(!defined('LINPHA_DIR')) { exit(1); } if(!isset($cat2)) Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/admin/metadata_define.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,4 +1,31 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program 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. +* +* This program 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 this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * @package admin + * @subpackage MetaData + * + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/admin/metadata_define_post.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,4 +1,31 @@ <?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program 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. +* +* This program 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 this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * @package admin + * @subpackage MetaData + * + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + if(!defined('LINPHA_DIR')) { exit(1); } switch($_POST['cmd']) Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/admin/metadata_select.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,13 +1,32 @@ <?php -if(!defined('LINPHA_DIR')) { exit(1); } +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program 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. +* +* This program 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 this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ /** * @package admin * @subpackage MetaData * - * for a description of the table structure, flag nr etc. see in the developper wiki at - * http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields */ + +if(!defined('LINPHA_DIR')) { exit(1); } if(!isset($cat3)) { Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/index.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -56,7 +56,7 @@ require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; case 'exif': - require_once(LINPHA_DIR.'/lib/include/File_Info_Show.php'); + require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); break; case 'video': require_once(LINPHA_DIR.'/lib/modules/module.video.php'); Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -19,8 +19,8 @@ */ /** - * This class handles all the EXIF and IPTC stuff used in LinPHA - * @package Metadata + * This class handles all the EXIF/IPTC/XMP stuff used in LinPHA + * @package MetaData * @author flo, bzrudi */ @@ -1060,12 +1060,6 @@ */ function saveModifiedMetaDataIptc( & $new_ps_file_info_array, $filename ) { - /** // Turn off Error Reporting - error_reporting ( 0 ); // Change: changed to no reporting - as of version 1.11 - - include 'Toolkit_Version.php'; // Change: added as of version 1.11*/ - - // Include the required files for reading and writing Photoshop File Info include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); include_once(LINPHA_DIR.'/lib/classes/pjmt/XMP.php'); include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php'); @@ -1074,48 +1068,19 @@ $GLOBALS[ "Software Name" ] = "LinPHA v".LINPHA_VERSION.", powered by PHP JPEG Metadata Toolkit v" . $GLOBALS['Toolkit_Version'] ; - // Copy all of the HTML Posted variables into an array - /** - * $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; - */ - - // Some characters are escaped with backslashes in HTML Posted variable - // Cycle through each of the HTML Posted variables, and strip out the slashes - /** - * already done in /include/common.php !! - * 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' ] ) ); - /** - // Make the filename easier to access - $filename = $new_ps_file_info_array[ 'filename' ]; - - // Protect against hackers editing other files - $path_parts = pathinfo( $filename ); - if ( strcasecmp( $path_parts["extension"], "jpg" ) != 0 ) - { - echo "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( $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 ) ); + //$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 @@ -1124,65 +1089,31 @@ // Check if the Update worked if ( $jpeg_header_data == FALSE ) { - // Update of file info didn't work - output error message /** * echo "Error - Failure update Photoshop File Info : $filename <br>\n"; */ linSysLog( i18n("Error: Failure update Photoshop File Info:" .' '. $filename) ); linLog( LOG_TYPE_META, LOG_ERR, 'meta_iptc', "Error: Failure update Photoshop File Info:" .' '. $filename ); - // Output HTML with the form and data which was - // sent, to allow the user to fix it - - /**$outputfilename = $filename; - include "Edit_File_info.php"; - echo "</body>\n"; - echo "</html>\n"; - - // Abort processing - exit( );*/ - return false; } // Attempt to write the new JPEG file elseif ( FALSE == put_jpeg_header_data( $filename, $filename, $jpeg_header_data ) ) { - // Writing of the new file didn't work - output error message /** * echo "Error - Failure to write new JPEG : $filename <br>\n"; */ linSysLog( i18n("Error: Failure to write new JPEG:" .' '. $filename) ); linLog( LOG_TYPE_META, LOG_ERR, 'meta_iptc', "Error: Failure to write new JPEG:" .' '. $filename ); - - // Output HTML with the form and data which was - // sent, to allow the user to fix it - - /**$outputfilename = $filename; - include "Edit_File_info.php"; - echo "</body>\n"; - echo "</html>\n"; - - // Abort processing - exit( );*/ - + return false; } else { // Writing of new JPEG succeeded - - // Output information about new file - linSysLog( i18n("DONE! Updated:" .' '. $filename) ); linLog( LOG_TYPE_META, LOG_NOTICE, 'meta_iptc', "Updated:" .' '. $filename ); - /** - echo "<h1>DONE! - $filename updated</h1>\n"; - echo "<p><a href=\"Example.php?jpeg_fname=$filename\" >View Full Metatdata Information</a></p>\n"; - echo "<p><a href=\"Edit_File_Info_Example.php?jpeg_fname=$filename\" >Re-Edit Photoshop File Info</a></p>\n"; - echo "<br><br>\n"; - echo "<p>Below is the updated image, you can save it and look at the changed MetaData in your favorite image editor</p>\n"; - echo "<p><img src=\"$filename\" ></p>\n";*/ return true; } Deleted: trunk/linpha2/lib/include/File_Info_Edit.php =================================================================== --- trunk/linpha2/lib/include/File_Info_Edit.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/lib/include/File_Info_Edit.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,590 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -/**************************************************************************** -* -* Filename: Edit_File_Info.php -* -* Description: Allows the user to edit the metadata of an image over the internet -* in the same way that Photoshop edits 'File Info' data -* This file provides only the html for a form containing the file info -* input fields. The rest of the html file must be provided by the calling script. -* $outputfilename must always be defined - it is ne name of the file which -* have the metadata changed after the form has been submitted -* -* This file has several modes of operation: -* -* 1) If $new_ps_file_info_array is defined then it's data will be used -* to fill the fields. -* 2) If $new_ps_file_info_array is not defined but $filename is defined, -* then the file info fields will be filled from the metadata in the file specified -* 3) If $new_ps_file_info_array is not defined but $filename and $default_ps_file_info_array -* are defined, then the file info fields will be filled from the metadata -* in the file specified, but where fields are blank, they will be filled from $default_ps_file_info_array -* 4) Otherwise the fields will be blank -* -* See Edit_File_Info_Example.php for an example of usage -* -* Author: Evan Hunter -* -* Date: 17/11/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.11 -* -* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* 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: ev...@oz... -* -***************************************************************************/ - -/** - * if $default_ps_file_info_array is set and the key 'date' is empty - * it will be auto filled with the exif date and we prevent errors like - * "Invalid Date - must be YYYY-MM-DD format" - */ -$default_ps_file_info_array = 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' => "" - ); - - include LINPHA_DIR.'/lib/classes/pjmt/Toolkit_Version.php'; // Change: added as of version 1.11 - global $new_ps_file_info_array; - - // 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_once( LINPHA_DIR.'/lib/classes/pjmt/JPEG.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/XMP.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/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 - - // Check if there is a EXIF Tag 36867 "Date and Time of Original" - if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 34665, $Exif_array[0] ) ) && - ( array_key_exists( 0, $Exif_array[0][34665] ) ) && - ( array_key_exists( 36867, $Exif_array[0][34665][0] ) ) ) - { - // Tag "Date and Time of Original" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36867]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - // Check if there is a EXIF Tag 36868 "Date and Time when Digitized" - else if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 34665, $Exif_array[0] ) ) && - ( array_key_exists( 0, $Exif_array[0][34665] ) ) && - ( array_key_exists( 36868, $Exif_array[0][34665][0] ) ) ) - { - // Tag "Date and Time when Digitized" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36868]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - // Check if there is a EXIF Tag 306 "Date and Time" - else if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 306, $Exif_array[0] ) ) ) - { - // Tag "Date and Time" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][306]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - else - { - // Couldn't find an EXIF date in the image - // Set default date as creation date of file - $default_ps_file_info_array['date'] = date ("Y-m-d", filectime( $filename )); - } - } - - // Cycle through all the elements of the default values array - foreach( $default_ps_file_info_array as $def_key =>$default_item ) - { - // Check if the current element is Keywords or - // Supplemental Categories as these are arrays - // and need to be treated differently - if ( ( strcasecmp( $def_key, "keywords" ) == 0 ) || - ( strcasecmp( $def_key, "supplementalcategories" ) == 0 ) ) - { - // Keywords or Supplemental Categories found - // Check if the File Info from the file is empty for this element - // and if there are default values in this array element - if ( ( count( $new_ps_file_info_array[ $def_key ] ) == 0 ) && - ( is_array( $default_item ) ) && - ( count( $default_item ) >= 0 ) ) - { - // The existing file info is empty, and there are - // defaults - add them - $new_ps_file_info_array[ $def_key ] = $default_item; - } - } - // Otherwise, this is not an array element, just check if it is blank in the existing file info - else if ( trim( $new_ps_file_info_array[ $def_key ] ) == "" ) - { - // The existing file info is blank, add the default value - $new_ps_file_info_array[ $def_key ] = $default_item; - } - - } - } - } - // Check for operation mode 4 - $new_ps_file_info_array and $filename are not defined, - else if ( ( ( !isset($new_ps_file_info_array) ) || ( ! is_array($new_ps_file_info_array) ) ) && - ( ( !isset($filename) ) || ( ! is_string( $filename ) ) ) ) - { - // No filename or new_ps_file_info_array defined, create a blank file info array to display - $new_ps_file_info_array = 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" => "" ); - } - - -/*************************************************************************** -* -* Now output the actual HTML form -* -***************************************************************************/ -/** -?> - - - - - <form name="EditJPEG" action="Write_File_Info.php" method="post"> - - - echo "<input name=\"filename\" type=\"hidden\" value=\"$outputfilename\">"; - - <table> -*/ -?> - <tr> - <td> - Title - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"title\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'title' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - <tr> - <td> - Author - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"author\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'author' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - <tr> - <td> - Authors Position - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"authorsposition\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'authorsposition' ], ENT_QUOTES) ."\"> - Note: not used in Photoshop 7 or higher"; - ?> - </td> - </tr> - - <tr> - <td> - Description - </td> - <td> - <textarea name="caption" class="linForms" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'caption' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - <tr> - <td> - Description Writer - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"captionwriter\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'captionwriter' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Keywords - </td> - <td> - <textarea class="linForms" name="keywords" rows=3 cols=37 wrap="off"><?php - foreach( $new_ps_file_info_array[ 'keywords' ] as $keyword ) - { - echo htmlspecialchars($keyword, ENT_QUOTES)."
"; - } - ?></textarea> - </td> - </tr> - - - <tr> - <td> - Copyright Status - </td> - <td> - <select size=1 class="linForms" name="copyrightstatus"> - <?php - $copystatus = $new_ps_file_info_array[ 'copyrightstatus' ]; - if ( $copystatus == "Unknown" ) - { - echo "<option value=\"Unknown\" SELECTED >Unknown</option>\n"; - } - else - { - echo "<option value=\"Unknown\">Unknown</option>\n"; - } - - if ( $copystatus == "Copyrighted Work" ) - { - echo "<option value=\"Copyrighted Work\" SELECTED >Copyrighted Work</option>\n"; - } - else - { - echo "<option value=\"Copyrighted Work\">Copyrighted Work</option>\n"; - } - - if ( $copystatus == "Public Domain" ) - { - echo "<option value=\"Public Domain\" SELECTED >Public Domain</option>\n"; - } - else - { - echo "<option value=\"Public Domain\">Public Domain</option>\n"; - } - ?> - </select> - </td> - </tr> - - - <tr> - <td> - Copyright Notice - </td> - <td> - <textarea class="linForms" name="copyrightnotice" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'copyrightnotice' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - <tr> - <td> - Copyright Info URL - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"ownerurl\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\">\n"; - if ($new_ps_file_info_array[ 'ownerurl' ] != "" ) - { - echo "<a href=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\" > (". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) .")</a>\n"; - } - ?> - - </td> - </tr> - - - <tr> - <td> - Category - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"category\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'category' ], ENT_QUOTES) ."\">\n"; - ?> - - </td> - </tr> - - <tr> - <td> - Supplemental Categories - </td> - <td> - <textarea class="linForms" name="supplementalcategories" rows=3 cols=37 wrap="off"><?php - foreach( $new_ps_file_info_array[ 'supplementalcategories' ] as $supcat ) - { - echo htmlspecialchars($supcat, ENT_QUOTES)."
"; - } - ?></textarea> - </td> - </tr> - - - - <tr> - <td> - Date Created - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"date\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'date' ], ENT_QUOTES) ."\">"; - ?> - - Note date must be YYYY-MM-DD format - </td> - </tr> - - <tr> - <td> - City - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"city\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'city' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - State - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"state\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'state' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Country - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"country\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'country' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - - <tr> - <td> - Credit - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"credit\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'credit' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Source - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"source\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'source' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - - <tr> - <td> - Headline - </td> - <td> - <textarea class="linForms" name="headline" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'headline' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - - <tr> - <td> - Instructions - </td> - <td> - <textarea class="linForms" name="instructions" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'instructions' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - <tr> - <td> - Transmission Reference - </td> - <td> - <textarea class="linForms" name="transmissionreference" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'transmissionreference' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - <tr> - <td> - Job Name - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"jobname\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'jobname' ], ENT_QUOTES) ."\"> - Note: not used in Photoshop CS"; - ?> - </td> - </tr> - - <tr> - <td> - Urgency - </td> - <td> - <select size="1" class="linForms" name="urgency"> - <?php - for( $i = 1; $i <= 8; $i++ ) - { - echo "<option value=\"$i\""; - if ( $new_ps_file_info_array[ 'urgency' ] == $i ) - { - echo " SELECTED "; - } - echo ">"; - if ( $i == 1 ) - { - echo "High"; - } - else if ( $i == 5 ) - { - echo "Normal"; - } - else if ( $i == 8 ) - { - echo "Low"; - } - else - { - echo "$i"; - } - echo "</option>\n"; - } - if ( $new_ps_file_info_array[ 'urgency' ] == "none" ) - { - echo "<option value=\"none\" SELECTED >None</option>"; - } - else - { - echo "<option value=\"none\" >None</option>"; - } - ?> - - </select> - </td> - </tr> Deleted: trunk/linpha2/lib/include/File_Info_Show.php =================================================================== --- trunk/linpha2/lib/include/File_Info_Show.php 2007-02-14 14:43:32 UTC (rev 4678) +++ trunk/linpha2/lib/include/File_Info_Show.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -1,280 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * check permissions - */ -if( !LinSql::photoIsAllowed( $GLOBALS['linpha']->template->idCurrent, $sql_perm_type = 'read' ) ) -{ - /** - * @todo use unified i18n STR_ACCESS_DENIED - */ - echo i18n("Access Denied!"); - exit(); -} - -/** - * valid id? - */ -$data = $GLOBALS['linpha']->db->GetRow( - "SELECT id, img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'" -); - -if( ! isset($data['id']) ) -{ - /** - * @todo use unified i18n STR_ACCESS_DENIED - */ - echo i18n("Access Denied!"); - exit(); -} - -/** - * only images - */ -if( ! LinIdentify::isSupportedImage($data['img_type'])) -{ - echo i18n("This Is Not An Image!"); - exit; -} - -$filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); -$filenameShow = implode( '/', LinSql::getFullFilenameFromId( $GLOBALS['linpha']->template->idCurrent ) ); - -?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> - -<!--*************************************************************************** -* -* Filename: Example.php -* -* Description: An example of how the PHP JPEG Metadata Toolkit can be used to -* display JPEG Metadata. -* -* Author: Evan Hunter -* -* Date: 30/7/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.11 -* -* Changes: 1.00 -> 1.10 : Changed name of GET parameter from 'filename' to 'jpeg_fname' -* to stop script-kiddies using the google command 'allinurl:*.php?filename=*' -* to find servers to attack -* Changed behavior when no filename is given, to be cleaner -* 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php -* Changed this example file to be easily relocatable -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* 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: ev...@oz... -* -***************************************************************************--> - - <head> - - <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> - <STYLE TYPE="text/css" MEDIA="screen, print, projection"> - <!-- - - BODY { background-color:#505050; color:#F0F0F0 } - a { color:orange } - .EXIF_Main_Heading { color:red } - .EXIF_Secondary_Heading{ color: orange} - .EXIF_Table { border-collapse: collapse ; border: 1px solid #909000} - .EXIF_Table tbody td{border-width: 1px; border-style:solid; border-color: #909000;} - - --> - </STYLE> - - - <?php - // Turn off Error Reporting - error_reporting ( 0 ); - - // Change: Allow this example file to be easily relocatable - as of version 1.11 - /**$Toolkit_Dir = "./"; // Ensure dir name includes trailing slash*/ - - // Hide any unknown EXIF tags - $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; - - /**include $Toolkit_Dir . 'Toolkit_Version.php'; // Change: added as of version 1.11 - include $Toolkit_Dir . 'JPEG.php'; // Change: Allow this example file to be easily relocatable - as of version 1.11 - include $Toolkit_Dir . 'JFIF.php'; - include $Toolkit_Dir . 'PictureInfo.php'; - include $Toolkit_Dir . 'XMP.php'; - include $Toolkit_Dir . 'Photoshop_IRB.php'; - include $Toolkit_Dir . 'EXIF.php';*/ - - include_once(LINPHA_DIR.'/lib/classes/pjmt/Toolkit_Version.php'); // Change: added as of version 1.11 - include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); // Change: Allow this example file to be easily relocatable - as of version 1.11 - include_once(LINPHA_DIR.'/lib/classes/pjmt/JFIF.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/PictureInfo.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/XMP.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/pjmt/EXIF.php'); - - /** - // Retrieve the JPEG image filename from the http url request - if ( ( !array_key_exists( 'jpeg_fname', $GLOBALS['HTTP_GET_VARS'] ) ) || - ( $GLOBALS['HTTP_GET_VARS']['jpeg_fname'] == "" ) ) - { - echo "<title>No image filename defined</title>\n"; - echo "</head>\n"; - echo "<body>\n"; - echo "<p>No image filename defined - use GET method with field: jpeg_fname</p>\n"; - echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 - echo "</body>\n"; - exit( ); - } - else - { - $filename = $GLOBALS['HTTP_GET_VARS']['jpeg_fname']; - }*/ - - - // Output the title - echo "<title>Metadata details for $filenameShow</title>"; - - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data( $filename ); - - ?> - - </head> - - <body> - - <p>Interpreted using: <a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - <br> - <br> - - <h1><B><U>Metadata for "<?php echo $filenameShow; ?>"</U></B></h1> - <br> - - <?php - /** - <!-- Output a link allowing user to edit the Photoshop File Info - Change: Allow this example file to be easily relocatable - as of version 1.11 - --> - <?php $relative_filename = get_relative_path( $filename, $Toolkit_Dir ); ?> - <h4><a href="<?php echo $Toolkit_Dir."Edit_File_Info_Example.php?jpeg_fname=$relative_filename"; ?>" >Click here to edit the Photoshop File Info for this file</a></h4> - <br> - */ - ?> - - - - <!-- Output the information about the APP segments --> - <?php echo Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Intrinsic JPEG Information --> - <?php echo Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG Comment --> - <?php echo Interpret_Comment_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG File Interchange Format Information --> - <?php echo Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JFIF Extension Information --> - <?php echo Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Picture Info Text --> - <?php echo Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the EXIF Information --> - <?php echo Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the XMP Information --> - <?php echo Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ) ); ?> - <BR> - <HR> - <BR> - - <!-- Output the Photoshop IRB (including the IPTC-NAA info --> - <?php echo Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Meta Information --> - <?php echo Interpret_EXIF_to_HTML( get_Meta_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <?php - /** - <!-- Display the original image --> - - <h2>Original Image</h2> - <?php echo "<img src=\"$filename\">"; ?> - */ - ?> - - - <BR> - <BR> - <BR> - <p>Interpreted using:</p> - <p><a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - - </body> - -</html> \ No newline at end of file Copied: trunk/linpha2/lib/include/metadata_info_edit.php (from rev 4671, trunk/linpha2/lib/include/File_Info_Edit.php) =================================================================== --- trunk/linpha2/lib/include/metadata_info_edit.php (rev 0) +++ trunk/linpha2/lib/include/metadata_info_edit.php 2007-02-15 11:18:24 UTC (rev 4679) @@ -0,0 +1,590 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/**************************************************************************** +* +* Filename: Edit_File_Info.php +* +* Description: Allows the user to edit the metadata of an image over the internet +* in the same way that Photoshop edits 'File Info' data +* This file provides only the html for a form containing the file info +* input fields. The rest of the html file must be provided by the calling script. +* $outputfilename must always be defined - it is ne name of the file which +* have the metadata changed after the form has been submitted +* +* This file has several modes of operation: +* +* 1) If $new_ps_file_info_array is defined then it's data will be used +* to fill the fields. +* 2) If $new_ps_file_info_array is not defined but $filename is defined, +* then the file info fields will be filled from the metadata in the file specified +* 3) If $new_ps_file_info_array is not defined but $filename and $default_ps_file_info_array +* are defined, then the file info fields will be filled from the metadata +* in the file specified, but where fields are blank, they will be filled from $default_ps_file_info_array +* 4) Otherwise the fields will be blank +* +* See Edit_File_Info_Example.php for an example of usage +* +* Author: Evan Hunter +* +* Date: 17/11/2004 +* +* Project: PHP JPEG Metadata Toolkit +* +* Revision: 1.11 +* +* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php +* +* URL: http://electronics.ozhiker.com +* +* Copyright: Copyright Evan Hunter 2004 +* +* 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 +* th... [truncated message content] |