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

📄 photoshop_irb.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 5 页
字号:
                                                $output_str .= "Display units for Image Width = Unknown Value (". $ResInfo['widthUnit'] .")\n";                                        }                                        if ( $ResInfo['heightUnit'] == 1 )                                        {                                                $output_str .= "Display units for Image Height = Inches";                                        }                                        elseif ( $ResInfo['heightUnit'] == 2 )                                        {                                                $output_str .= "Display units for Image Height = Centimetres";                                        }                                        elseif ( $ResInfo['heightUnit'] == 3 )                                        {                                                $output_str .= "Display units for Image Height = Points";                                        }                                        elseif ( $ResInfo['heightUnit'] == 4 )                                        {                                                $output_str .= "Display units for Image Height = Picas";                                        }                                        elseif ( $ResInfo['heightUnit'] == 5 )                                        {                                                $output_str .= "Display units for Image Height = Columns";                                        }                                        else                                        {                                                $output_str .= "Display units for Image Height = Unknown Value (". $ResInfo['heightUnit'] .")";                                        }                                        $output_str .= "</pre></td></tr>\n";                                        break;                                default : // All other records                                        $output_str .= "<tr class=\"Photoshop_Table_Row\"><td class=\"Photoshop_Caption_Cell\">$Resource_Name</td><td class=\"Photoshop_Value_Cell\">RESOURCE DECODING NOT IMPLEMENTED YET<BR>" . strlen( $IRB_Resource['ResData'] ) . " bytes</td></tr>\n";                        }                }                // Add the table end to the HTML                $output_str .= "</table>\n";                // Add any secondary output to the HTML                $output_str .= $secondary_output_str;        }        // Return the HTML        return $output_str;}/******************************************************************************* End of Function:     Interpret_IRB_to_HTML******************************************************************************//********************************************************************************         INTERNAL FUNCTIONS*******************************************************************************//******************************************************************************** Function:     unpack_Photoshop_IRB_Data** Description:  Extracts Photoshop Information Resource Block (IRB) information*               from a binary string containing the IRB, as read from a file** Parameters:   IRB_Data - The binary string containing the IRB** Returns:      IRBdata - The array of Photoshop IRB records*******************************************************************************/function unpack_Photoshop_IRB_Data( $IRB_Data ){        $pos = 0;        // Cycle through the IRB and extract its records - Records are started with 8BIM, so cycle until no more instances of 8BIM can be found        while ( ( $pos < strlen( $IRB_Data ) ) && ( ($pos = strpos( $IRB_Data, "8BIM", $pos) ) !== FALSE ) )        {                // Skip the position over the 8BIM characters                $pos += 4;                // Next two characters are the record ID - denoting what type of record it is.                $ID = ord( $IRB_Data{ $pos } ) * 256 + ord( $IRB_Data{ $pos +1 } );                // Skip the positionover the two record ID characters                $pos += 2;                // Next comes a Record Name - usually not used, but it should be a null terminated string, padded with 0x00 to be an even length                $namestartpos = $pos;                // Change: Fixed processing of embedded resource names, as of revision 1.10                // NOTE: Photoshop does not process resource names according to the standard :                // "Adobe Photoshop 6.0 File Formats Specification, Version 6.0, Release 2, November 2000"                //                // The resource name is actually formatted as follows:                // One byte name length, followed by the null terminated ascii name string.                // The field is then padded with a Null character if required, to ensure that the                // total length of the name length and name is even.                // Name - process it                // Get the length                $namelen = ord ( $IRB_Data{ $namestartpos } );                // Total length of name and length info must be even, hence name length must be odd                // Check if the name length is even,                if ( $namelen % 2 == 0 )                {                        // add one to length to make it odd                        $namelen ++;                }                // Extract the name                $resembeddedname = trim( substr ( $IRB_Data, $namestartpos+1,  $namelen) );                $pos += $namelen + 1;                // Next is a four byte size field indicating the size in bytes of the record's data  - MSB first                $datasize =     ord( $IRB_Data{ $pos } ) * 16777216 + ord( $IRB_Data{ $pos + 1 } ) * 65536 +                                ord( $IRB_Data{ $pos + 2 } ) * 256 + ord( $IRB_Data{ $pos + 3 } );                $pos += 4;                // The record is stored padded with 0x00 characters to make the size even, so we need to calculate the stored size                $storedsize =  $datasize + ($datasize % 2);                $resdata = substr ( $IRB_Data, $pos, $datasize );                // Get the description for this resource                // Check if this is a Path information Resource, since they have a range of ID's                if ( ( $ID >= 0x07D0 ) && ( $ID <= 0x0BB6 ) )                {                        $ResDesc = "ID Info : Path Information (saved paths).";                }                else                {                        if ( array_key_exists( $ID, $GLOBALS[ "Photoshop_ID_Descriptions" ] ) )                        {                                $ResDesc = $GLOBALS[ "Photoshop_ID_Descriptions" ][ $ID ];                        }                        else                        {                                $ResDesc = "";                        }                }                // Get the Name of the Resource                if ( array_key_exists( $ID, $GLOBALS[ "Photoshop_ID_Names" ] ) )                {                        $ResName = $GLOBALS['Photoshop_ID_Names'][ $ID ];                }                else                {                        $ResName = "";                }                // Store the Resource in the array to be returned                $IRB_Array[] = array(     "ResID" => $ID,                                        "ResName" => $ResName,                                        "ResDesc" => $ResDesc,                                        "ResEmbeddedName" => $resembeddedname,                                        "ResData" => $resdata );                // Jump over the data to the next record                $pos += $storedsize;        }        // Return the array created        return $IRB_Array;}/******************************************************************************* End of Function:     unpack_Photoshop_IRB_Data******************************************************************************//******************************************************************************** Function:     pack_Photoshop_IRB_Data** Description:  Packs a Photoshop Information Resource Block (IRB) array into it's*               binary form, which can be written to a file** Parameters:   IRB_data - an Photoshop IRB array to be converted. Should be in*                          the same format as received from get_Photoshop_IRB** Returns:      packed_IRB_data - the binary string of packed IRB data*******************************************************************************/function pack_Photoshop_IRB_Data( $IRB_data ){        $packed_IRB_data = "";        // Cycle through each resource in the IRB,        foreach ($IRB_data as $resource)        {                // Change: Fix to avoid creating blank resources, as of revision 1.10                // Check if there is actually any data for this resource                if( strlen( $resource['ResData'] ) == 0 )                {                        // No data 

⌨️ 快捷键说明

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