• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP unRational函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中unRational函数的典型用法代码示例。如果您正苦于以下问题:PHP unRational函数的具体用法?PHP unRational怎么用?PHP unRational使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unRational函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: formatOlympusData

function formatOlympusData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
            if ($intel == 1) {
                $data = intel2Moto($data);
            }
            if ($tag == "0204") {
                //DigitalZoom
                $data = $data . "x";
            }
            if ($tag == "0205") {
                //Unknown2
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                if ($tag == "0201") {
                    //JPEGQuality
                    if ($data == 1) {
                        $data = "SQ";
                    } else {
                        if ($data == 2) {
                            $data = "HQ";
                        } else {
                            if ($data == 3) {
                                $data = "SHQ";
                            } else {
                                $data = gettext("Unknown") . ": " . $data;
                            }
                        }
                    }
                }
                if ($tag == "0202") {
                    //Macro
                    if ($data == 0) {
                        $data = "Normal";
                    } else {
                        if ($data == 1) {
                            $data = "Macro";
                        } else {
                            $data = gettext("Unknown") . ": " . $data;
                        }
                    }
                }
            } else {
                if ($type == "UNDEFINED") {
                } else {
                    $data = bin2hex($data);
                    if ($intel == 1) {
                        $data = intel2Moto($data);
                    }
                }
            }
        }
    }
    return $data;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:60,代码来源:olympus.php


示例2: formatSanyoData

function formatSanyoData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                if ($tag == "0200") {
                    //SpecialMode
                    if ($data == 0) {
                        $data = gettext("Normal");
                    } else {
                        $data = gettext("Unknown") . ": " . $data;
                    }
                }
                if ($tag == "0201") {
                    //Quality
                    if ($data == 2) {
                        $data = gettext("High");
                    } else {
                        $data = gettext("Unknown") . ": " . $data;
                    }
                }
                if ($tag == "0202") {
                    //Macro
                    if ($data == 0) {
                        $data = gettext("Normal");
                    } else {
                        $data = gettext("Unknown") . ": " . $data;
                    }
                }
            } else {
                if ($type == "UNDEFINED") {
                } else {
                    $data = bin2hex($data);
                    if ($intel == 1) {
                        $data = intel2Moto($data);
                    }
                }
            }
        }
    }
    return $data;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:46,代码来源:sanyo.php


示例3: formatData

function formatData($type, $tag, $intel, $data)
{
    switch ($type) {
        case 'ASCII':
            if (($pos = strpos($data, chr(0))) !== false) {
                // Search for a null byte and stop there.
                $data = substr($data, 0, $pos);
            }
            if ($tag == '010f') {
                $data = ucwords(strtolower(trim($data)));
            }
            // Format certain kinds of strings nicely (Camera make etc.)
            break;
        case 'URATIONAL':
        case 'SRATIONAL':
            switch ($tag) {
                case '011a':
                    // XResolution
                // XResolution
                case '011b':
                    // YResolution
                    $data = round(unRational($data, $type, $intel)) . ' dots per ResolutionUnit';
                    break;
                case '829a':
                    // Exposure Time
                    $data = formatExposure(unRational($data, $type, $intel));
                    break;
                case '829d':
                    // FNumber
                    $data = 'f/' . unRational($data, $type, $intel);
                    break;
                case '9204':
                    // ExposureBiasValue
                    $data = round(unRational($data, $type, $intel), 2) . ' EV';
                    break;
                case '9205':
                    // ApertureValue
                // ApertureValue
                case '9202':
                    // MaxApertureValue
                    // ApertureValue is given in the APEX Mode. Many thanks to Matthieu Froment for this code
                    // The formula is : Aperture = 2*log2(FNumber) <=> FNumber = e((Aperture.ln(2))/2)
                    $datum = exp(unRational($data, $type, $intel) * log(2) / 2);
                    $data = round($datum, 1);
                    // Focal is given with a precision of 1 digit.
                    $data = 'f/' . $datum;
                    break;
                case '920a':
                    // FocalLength
                    $data = unRational($data, $type, $intel) . ' mm';
                    break;
                case '9201':
                    // ShutterSpeedValue
                    // The ShutterSpeedValue is given in the APEX mode. Many thanks to Matthieu Froment for this code
                    // The formula is : Shutter = - log2(exposureTime) (Appendix C of EXIF spec.)
                    // Where shutter is in APEX, log2(exposure) = ln(exposure)/ln(2)
                    // So final formula is : exposure = exp(-ln(2).shutter)
                    // The formula can be developed : exposure = 1/(exp(ln(2).shutter))
                    $datum = exp(unRational($data, $type, $intel) * log(2));
                    if ($datum != 0) {
                        $datum = 1 / $datum;
                    }
                    $data = formatExposure($datum);
                    break;
                default:
                    $data = unRational($data, $type, $intel);
                    break;
            }
            break;
        case 'USHORT':
        case 'SSHORT':
        case 'ULONG':
        case 'SLONG':
        case 'FLOAT':
        case 'DOUBLE':
            $data = rational($data, $type, $intel);
            switch ($tag) {
                case '0112':
                    // Orientation
                    // Example of how all of these tag formatters should be...
                    switch ($data) {
                        case 0:
                            // not set, presume normal
                        // not set, presume normal
                        case 1:
                            $data = gettext('1: Normal (0 deg)');
                            break;
                        case 2:
                            $data = gettext('2: Mirrored');
                            break;
                        case 3:
                            $data = gettext('3: Upside-down');
                            break;
                        case 4:
                            $data = gettext('4: Upside-down Mirrored');
                            break;
                        case 5:
                            $data = gettext('5: 90 deg CW Mirrored');
                            break;
                        case 6:
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:core,代码行数:101,代码来源:exif.php


示例4: formatGPSData

function formatGPSData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
        if ($tag == "0001" || $tag == "0003") {
            // Latitude Reference, Longitude Reference
            $data = $data[1] == $data[2] && $data[1] == $data[3] ? $data[0] : $data;
        }
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            if ($tag == "0002" || $tag == "0004" || $tag == '0007') {
                //Latitude, Longitude, Time
                $datum = array();
                for ($i = 0; $i < strlen($data); $i = $i + 8) {
                    array_push($datum, substr($data, $i, 8));
                }
                $hour = unRational($datum[0], $type, $intel);
                $minutes = unRational($datum[1], $type, $intel);
                $seconds = unRational($datum[2], $type, $intel);
                if ($tag == "0007") {
                    //Time
                    $data = $hour . ":" . $minutes . ":" . $seconds;
                } else {
                    $data = $hour + $minutes / 60 + $seconds / 3600;
                }
            } else {
                $data = unRational($data, $type, $intel);
                if ($tag == "0006") {
                    $data .= 'm';
                }
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
            } else {
                if ($type == "UNDEFINED") {
                } else {
                    if ($type == "UBYTE") {
                        $data = bin2hex($data);
                        if ($intel == 1) {
                            $num = intel2Moto($data);
                        }
                        if ($tag == "0000") {
                            // VersionID
                            $data = hexdec(substr($data, 0, 2)) . "." . hexdec(substr($data, 2, 2)) . "." . hexdec(substr($data, 4, 2)) . "." . hexdec(substr($data, 6, 2));
                        } else {
                            if ($tag == "0005") {
                                // Altitude Reference
                                if ($data == "00000000") {
                                    $data = '+';
                                } else {
                                    if ($data == "01000000") {
                                        $data = '-';
                                    }
                                }
                            }
                        }
                    } else {
                        $data = bin2hex($data);
                        if ($intel == 1) {
                            $data = intel2Moto($data);
                        }
                    }
                }
            }
        }
    }
    return $data;
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine_1.6.x,代码行数:68,代码来源:gps.php


示例5: formatFujifilmData

function formatFujifilmData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
            if ($tag == "1011") {
                //FlashStrength
                $data = $data . " EV";
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                if ($tag == "1001") {
                    //Sharpness
                    if ($data == 1) {
                        $data = gettext("Soft");
                    } else {
                        if ($data == 2) {
                            $data = gettext("Soft");
                        } else {
                            if ($data == 3) {
                                $data = gettext("Normal");
                            } else {
                                if ($data == 4) {
                                    $data = gettext("Hard");
                                } else {
                                    if ($data == 5) {
                                        $data = gettext("Hard");
                                    } else {
                                        $data = gettext("Unknown") . ": " . $data;
                                    }
                                }
                            }
                        }
                    }
                }
                if ($tag == "1002") {
                    //WhiteBalance
                    if ($data == 0) {
                        $data = gettext("Auto");
                    } else {
                        if ($data == 256) {
                            $data = gettext("Daylight");
                        } else {
                            if ($data == 512) {
                                $data = gettext("Cloudy");
                            } else {
                                if ($data == 768) {
                                    $data = gettext("DaylightColor-fluorescence");
                                } else {
                                    if ($data == 769) {
                                        $data = gettext("DaywhiteColor-fluorescence");
                                    } else {
                                        if ($data == 770) {
                                            $data = gettext("White-fluorescence");
                                        } else {
                                            if ($data == 1024) {
                                                $data = gettext("Incandescence");
                                            } else {
                                                if ($data == 3840) {
                                                    $data = gettext("Custom");
                                                } else {
                                                    $data = gettext("Unknown") . ": " . $data;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if ($tag == "1003") {
                    //Color
                    if ($data == 0) {
                        $data = gettext("Chroma Saturation Normal(STD)");
                    } else {
                        if ($data == 256) {
                            $data = gettext("Chroma Saturation High");
                        } else {
                            if ($data == 512) {
                                $data = gettext("Chroma Saturation Low(ORG)");
                            } else {
                                $data = gettext("Unknown: ") . $data;
                            }
                        }
                    }
                }
                if ($tag == "1004") {
                    //Tone
                    if ($data == 0) {
                        $data = gettext("Contrast Normal(STD)");
                    } else {
                        if ($data == 256) {
                            $data = gettext("Contrast High(HARD)");
                        } else {
                            if ($data == 512) {
                                $data = gettext("Contrast Low(ORG)");
                            } else {
//.........这里部分代码省略.........
开发者ID:CatBerg-TestOrg,项目名称:coppermine_1.6.x,代码行数:101,代码来源:fujifilm.php


示例6: formatCanonData

function formatCanonData($type, $tag, $intel, $data, $exif, &$result)
{
    $place = 0;
    if ($type == "ASCII") {
        $result = $data = str_replace("", "", $data);
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
            if ($tag == "0204") {
                //DigitalZoom
                $data = $data . "x";
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                $result['RAWDATA'] = $data;
                if ($tag == "0001") {
                    //first chunk
                    $result['Bytes'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //0
                    if ($result['Bytes'] != strlen($data) / 2) {
                        return $result;
                    }
                    //Bad chunk
                    $result['Macro'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //1
                    switch ($result['Macro']) {
                        case 1:
                            $result['Macro'] = gettext("Macro");
                            break;
                        case 2:
                            $result['Macro'] = gettext("Normal");
                            break;
                        default:
                            $result['Macro'] = gettext("Unknown");
                    }
                    $result['SelfTimer'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //2
                    switch ($result['SelfTimer']) {
                        case 0:
                            $result['SelfTimer'] = gettext("Off");
                            break;
                        default:
                            $result['SelfTimer'] .= gettext("/10s");
                    }
                    $result['Quality'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //3
                    switch ($result['Quality']) {
                        case 2:
                            $result['Quality'] = gettext("Normal");
                            break;
                        case 3:
                            $result['Quality'] = gettext("Fine");
                            break;
                        case 5:
                            $result['Quality'] = gettext("Superfine");
                            break;
                        default:
                            $result['Quality'] = gettext("Unknown");
                    }
                    $result['Flash'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //4
                    switch ($result['Flash']) {
                        case 0:
                            $result['Flash'] = gettext("Off");
                            break;
                        case 1:
                            $result['Flash'] = gettext("Auto");
                            break;
                        case 2:
                            $result['Flash'] = gettext("On");
                            break;
                        case 3:
                            $result['Flash'] = gettext("Red Eye Reduction");
                            break;
                        case 4:
                            $result['Flash'] = gettext("Slow Synchro");
                            break;
                        case 5:
                            $result['Flash'] = gettext("Auto + Red Eye Reduction");
                            break;
                        case 6:
                            $result['Flash'] = gettext("On + Red Eye Reduction");
                            break;
                        case 16:
                            $result['Flash'] = gettext("External Flash");
                            break;
                        default:
                            $result['Flash'] = gettext("Unknown");
                    }
                    $result['DriveMode'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //5
                    switch ($result['DriveMode']) {
                        case 0:
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:core,代码行数:101,代码来源:canon.php


示例7: formatNikonData

function formatNikonData($type, $tag, $intel, $model, $data)
{
    switch ($type) {
        case "ASCII":
            break;
            // do nothing!
        // do nothing!
        case "URATIONAL":
        case "SRATIONAL":
            switch ($tag) {
                case '0084':
                    // LensInfo
                    $minFL = unRational(substr($data, 0, 8), $type, $intel);
                    $maxFL = unRational(substr($data, 8, 8), $type, $intel);
                    $minSP = unRational(substr($data, 16, 8), $type, $intel);
                    $maxSP = unRational(substr($data, 24, 8), $type, $intel);
                    if ($minFL == $maxFL) {
                        $data = sprintf('%0.0f f/%0.0f', $minFL, $minSP);
                    } elseif ($minSP == $maxSP) {
                        $data = sprintf('%0.0f-%0.0fmm f/%0.1f', $minFL, $maxFL, $minSP);
                    } else {
                        $data = sprintf('%0.0f-%0.0fmm f/%0.1f-%0.1f', $minFL, $maxFL, $minSP, $maxSP);
                    }
                    break;
                case "0085":
                    if ($model == 1) {
                        $data = unRational($data, $type, $intel) . " m";
                    }
                    //ManualFocusDistance
                    break;
                case "0086":
                    if ($model == 1) {
                        $data = unRational($data, $type, $intel) . "x";
                    }
                    //DigitalZoom
                    break;
                case "000a":
                    if ($model == 0) {
                        $data = unRational($data, $type, $intel) . "x";
                    }
                    //DigitalZoom
                    break;
                default:
                    $data = unRational($data, $type, $intel);
                    break;
            }
            break;
        case "USHORT":
        case $type == "SSHORT":
        case $type == "ULONG":
        case $type == "SLONG":
        case $type == "FLOAT":
        case $type == "DOUBLE":
            $data = rational($data, $type, $intel);
            switch ($tag) {
                case "0003":
                    if ($model == 0) {
                        //Quality
                        switch ($data) {
                            case 1:
                                $data = gettext("VGA Basic");
                                break;
                            case 2:
                                $data = gettext("VGA Normal");
                                break;
                            case 3:
                                $data = gettext("VGA Fine");
                                break;
                            case 4:
                                $data = gettext("SXGA Basic");
                                break;
                            case 5:
                                $data = gettext("SXGA Normal");
                                break;
                            case 6:
                                $data = gettext("SXGA Fine");
                                break;
                            default:
                                $data = gettext("Unknown") . ": " . $data;
                                break;
                        }
                    }
                    break;
                case "0004":
                    if ($model == 0) {
                        //Color
                        switch ($data) {
                            case 1:
                                $data = gettext("Color");
                                break;
                            case 2:
                                $data = gettext("Monochrome");
                                break;
                            default:
                                $data = gettext("Unknown") . ": " . $data;
                                break;
                        }
                    }
                    break;
                case "0005":
//.........这里部分代码省略.........
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:101,代码来源:nikon.php


示例8: formatFujifilmData

function formatFujifilmData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
            if ($tag == "1011") {
                //FlashStrength
                $data = $data . " EV";
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                if ($tag == "1001") {
                    //Sharpness
                    if ($data == 1) {
                        $data = '!soft!';
                    } else {
                        if ($data == 2) {
                            $data = '!soft!';
                        } else {
                            if ($data == 3) {
                                $data = '!normal!';
                            } else {
                                if ($data == 4) {
                                    $data = '!hard!';
                                } else {
                                    if ($data == 5) {
                                        $data = '!hard!';
                                    } else {
                                        $data = '!unknown!' . ": " . $data;
                                    }
                                }
                            }
                        }
                    }
                }
                if ($tag == "1002") {
                    //WhiteBalance
                    if ($data == 0) {
                        $data = '!auto!';
                    } else {
                        if ($data == 256) {
                            $data = '!daylight!';
                        } else {
                            if ($data == 512) {
                                $data = '!cloudy!';
                            } else {
                                if ($data == 768) {
                                    $data = '!daylightcolor-fluorescence!';
                                } else {
                                    if ($data == 769) {
                                        $data = '!daywhitecolor-fluorescence!';
                                    } else {
                                        if ($data == 770) {
                                            $data = '!white-fluorescence!';
                                        } else {
                                            if ($data == 1024) {
                                                $data = '!incandescence!';
                                            } else {
                                                if ($data == 3840) {
                                                    $data = '!custom!';
                                                } else {
                                                    $data = '!unknown!' . ": " . $data;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if ($tag == "1003") {
                    //Color
                    if ($data == 0) {
                        $data = '!chroma saturation normal(std)!';
                    } else {
                        if ($data == 256) {
                            $data = '!chroma saturation high!';
                        } else {
                            if ($data == 512) {
                                $data = '!chroma saturation low(org)!';
                            } else {
                                $data = '!unknown!' . ':' . $data;
                            }
                        }
                    }
                }
                if ($tag == "1004") {
                    //Tone
                    if ($data == 0) {
                        $data = '!contrast normal(std)!';
                    } else {
                        if ($data == 256) {
                            $data = '!contrast high(hard)!';
                        } else {
                            if ($data == 512) {
                                $data = '!contrast low(org)!';
                            } else {
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:fujifilm.php


示例9: formatPanasonicData

function formatPanasonicData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
    } else {
        if ($type == "UBYTE" || $type == "SBYTE") {
            $data = bin2hex($data);
            if ($intel == 1) {
                $data = intel2Moto($data);
            }
            $data = hexdec($data);
            if ($tag == "000f") {
                //AFMode
                if ($data == 256) {
                    $data = "9-area-focusing";
                } else {
                    if ($data == 16) {
                        $data = "1-area-focusing";
                    } else {
                        if ($data == 4096) {
                            $data = gettext("3-area-focusing (High speed)");
                        } else {
                            if ($data == 4112) {
                                $data = gettext("1-area-focusing (High speed)");
                            } else {
                                if ($data == 16) {
                                    $data = gettext("1-area-focusing");
                                } else {
                                    if ($data == 1) {
                                        $data = gettext("Spot-focusing");
                                    } else {
                                        $data = "Unknown (" . $data . ")";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($type == "URATIONAL" || $type == "SRATIONAL") {
                $data = unRational($data, $type, $intel);
            } else {
                if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                    $data = rational($data, $type, $intel);
                    if ($tag == "0001") {
                        //Image Quality
                        if ($data == 2) {
                            $data = gettext("High");
                        } else {
                            if ($data == 3) {
                                $data = gettext("Standard");
                            } else {
                                if ($data == 6) {
                                    $data = gettext("Very High");
                                } else {
                                    if ($data == 7) {
                                        $data = gettext("RAW");
                                    } else {
                                        $data = gettext("Unknown") . " (" . $data . ")";
                                    }
                                }
                            }
                        }
                    }
                    if ($tag == "0003") {
                        //White Balance
                        if ($data == 1) {
                            $data = gettext("Auto");
                        } else {
                            if ($data == 2) {
                                $data = gettext("Daylight");
                            } else {
                                if ($data == 3) {
                                    $data = gettext("Cloudy");
                                } else {
                                    if ($data == 4) {
                                        $data = gettext("Halogen");
                                    } else {
                                        if ($data == 5) {
                                            $data = gettext("Manual");
                                        } else {
                                            if ($data == 8) {
                                                $data = gettext("Flash");
                                            } else {
                                                if ($data == 10) {
                                                    $data = gettext("Black and White");
                                                } else {
                                                    if ($data == 11) {
                                                        $data = gettext("Manual");
                                                    } else {
                                                        $data = gettext("Unknown") . " (" . $data . ")";
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:JoseCOCA,项目名称:baudprint,代码行数:101,代码来源:panasonic.php


示例10: formatCanonData

function formatCanonData($type, $tag, $intel, $data, $exif, &$result)
{
    $place = 0;
    if ($type == "ASCII") {
        $result = $data = str_replace("", "", $data);
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = unRational($data, $type, $intel);
            if ($tag == "0204") {
                //DigitalZoom
                $data = $data . "x";
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = rational($data, $type, $intel);
                $result['RAWDATA'] = $data;
                if ($tag == "0001") {
                    //first chunk
                    $result['Bytes'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //0
                    if ($result['Bytes'] != strlen($data) / 2) {
                        return $result;
                    }
                    //Bad chunk
                    $result['Macro'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //1
                    switch ($result['Macro']) {
                        case 1:
                            $result['Macro'] = '!macro!';
                            break;
                        case 2:
                            $result['Macro'] = '!normal!';
                            break;
                        default:
                            $result['Macro'] = '!unknown!';
                    }
                    $result['SelfTimer'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //2
                    switch ($result['SelfTimer']) {
                        case 0:
                            $result['SelfTimer'] = '!off!';
                            break;
                        default:
                            $result['SelfTimer'] .= "/10s";
                    }
                    $result['Quality'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //3
                    switch ($result['Quality']) {
                        case 2:
                            $result['Quality'] = '!normal!';
                            break;
                        case 3:
                            $result['Quality'] = '!fine!';
                            break;
                        case 5:
                            $result['Quality'] = '!superfine!';
                            break;
                        default:
                            $result['Quality'] = '!unknown!';
                    }
                    $result['Flash'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //4
                    switch ($result['Flash']) {
                        case 0:
                            $result['Flash'] = '!off!';
                            break;
                        case 1:
                            $result['Flash'] = '!auto!';
                            break;
                        case 2:
                            $result['Flash'] = '!on!';
                            break;
                        case 3:
                            $result['Flash'] = '!red eye reduction!';
                            break;
                        case 4:
                            $result['Flash'] = '!slow synchro!';
                            break;
                        case 5:
                            $result['Flash'] = '!auto + red eye reduction!';
                            break;
                        case 6:
                            $result['Flash'] = '!on + red eye reduction!';
                            break;
                        case 16:
                            $result['Flash'] = '!external flash!';
                            break;
                        default:
                            $result['Flash'] = '!unknown!';
                    }
                    $result['DriveMode'] = hexdec(intel2Moto(substr($data, $place, 4)));
                    $place += 4;
                    //5
                    switch ($result['DriveMode']) {
                        case 0:
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:canon.php


示例11: formatData

function formatData($type, $tag, $intel, $data)
{
    switch ($type) {
        case 'ASCII':
            if (($pos = strpos($data, chr(0))) !== false) {
                // Search for a null byte and stop there.
                $data = substr($data, 0, $pos);
            }
            if ($tag == '010f') {
                $data = ucwords(strtolower(trim($data)));
            }
            // Format certain kinds of strings nicely (Camera make etc.)
            break;
        case 'URATIONAL':
        case 'SRATIONAL':
            switch ($tag) {
                case '011a':
                    // XResolution
                // XResolution
                case '011b':
                    // YResolution
                    $data = round(unRational($data, $type, $intel)) . ' dots per ResolutionUnit';
                    break;
                case '829a':
                    // Exposure Time
                    $data = formatExposure(unRational($data, $type, $intel));
                    break;
                case '829d':
                    // FNumber
                    $data = 'f/' . round(unRational($data, $type, $intel), 2);
                    break;
                case '9204':
                    // ExposureBiasValue (assume signed!)
                    $data = round(unRational($data, 'SRATIONAL', $intel), 2) . ' EV';
                    break;
                case '9205':
                    // ApertureValue
                // ApertureValue
                case '9202':
                    // MaxApertureValue
                    // ApertureValue is given in the APEX Mode. Many thanks to Matthieu Froment for this code
                    // The formula is : Aperture = 2*log2(FNumber) <=> FNumber = e((Aperture.ln(2))/2)
                    $datum = exp(unRational($data, $type, $intel) * log(2) / 2);
                    $data = 'f/' . round($datum, 1);
                    // Focal is given with a precision of 1 digit.
                    break;
                case '920a':
                    // FocalLength
                    $data = unRational($data, $type, $intel) . ' mm';
                    break;
                case '9201':
                    // ShutterSpeedValue
                    // The ShutterSpeedValue is given in the APEX mode. Many thanks to Matthieu Froment for this code
                    // The formula is : Shutter = - log2(exposureTime) (Appendix C of EXIF spec.)
                    // Where shutter is in APEX, log2(exposure) = ln(exposure)/ln(2)
                    // So final formula is : exposure = exp(-ln(2).shutter)
                    // The formula can be developed : exposure = 1/(exp(ln(2).shutter))
                    $datum = exp(unRational($data, $type, $intel) * log(2));
                    if ($datum != 0) {
                        $datum = 1 / $datum;
                    }
                    $data = formatExposure($datum);
                    break;
                default:
                    $data = unRational($data, $type, $intel);
                    break;
            }
            break;
        case 'USHORT':
        case 'SSHORT':
        case 'ULONG':
        case 'SLONG':
        case 'FLOAT':
        case 'DOUBLE':
            $data = rational($data, $type, $intel);
            switch ($tag) {
                case '0112':
                    // Orientation
                    // Example of how all of these tag formatters should be...
                    switch ($data) {
                        case 0:
                            // not set, presume normal
                        // not set, presume normal
                        case 1:
                            $data = '!1: normal (0 deg)!';
                            break;
                        case 2:
                            $data = '!2: mirrored!';
                            break;
                        case 3:
                            $data = '!3: upside-down!';
                            break;
                        case 4:
                            $data = '!4: upside-down mirrored!';
                            break;
                        case 5:
                            $data = '!5: 90 deg ccw mirrored!';
                            break;
                        case 6:
                            $data = '!6: 90 deg cw!';
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:exif.php


示例12: formatNikonData

function formatNikonData($type, $tag, $intel, $model, $data)
{
    switch ($type) {
        case "ASCII":
            break;
            // do nothing!
        // do nothing!
        case "URATIONAL":
        case "SRATIONAL":
            switch ($tag) {
                case '0084':
                    // LensInfo
                    $minFL = unRational(substr($data, 0, 8), $type, $intel);
                    $maxFL = unRational(substr($data, 8, 8), $type, $intel);
                    $minSP = unRational(substr($data, 16, 8), $type, $intel);
                    $maxSP = unRational(substr($data, 24, 8), $type, $intel);
                    if ($minFL == $maxFL) {
                        $data = sprintf('%0.0fmm f/%0.1f', $minFL, $minSP);
                    } elseif ($minSP == $maxSP) {
                        $data = sprintf('%0.0f-%0.0fmm f/%0.1f', $minFL, $maxFL, $minSP);
                    } else {
                        $data = sprintf('%0.0f-%0.0fmm f/%0.1f-%0.1f', $minFL, $maxFL, $minSP, $maxSP);
                    }
                    break;
                case "0085":
                    if ($model == 1) {
                        $data = unRational($data, $type, $intel) . " m";
                    }
                    //ManualFocusDistance
                    break;
                case "0086":
                    if ($model == 1) {
                        $data = unRational($data, $type, $intel) . "x";
                    }
                    //DigitalZoom
                    break;
                case "000a":
                    if ($model == 0) {
                        $data = unRational($data, $type, $intel) . "x";
                    }
                    //DigitalZoom
                    break;
                default:
                    $data = unRational($data, $type, $intel);
                    break;
            }
            break;
        case "USHORT":
        case $type == "SSHORT":
        case $type == "ULONG":
        case $type == "SLONG":
        case $type == "FLOAT":
        case $type == "DOUBLE":
            $data = rational($data, $type, $intel);
            switch ($tag) {
                case "0003":
                    if ($model == 0) {
                        //Quality
                        switch ($data) {
                            case 1:
                                $data = '!vga basic!';
                                break;
                            case 2:
                                $data = '!vga normal!';
                                break;
                            case 3:
                                $data = '!vga fine!';
                                break;
                            case 4:
                                $data = '!sxga basic!' 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP un_htmlspecialchars函数代码示例发布时间:2022-05-23
下一篇:
PHP umc_mysql_query函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap