Ejemplo n.º 1
0
Archivo: exif.php Proyecto: anqh/core
function formatExposure($data)
{
    if (strpos($data, '/') === false) {
        if ($data > 1) {
            return round($data, 2) . ' ' . gettext('sec');
        } else {
            $n = 0;
            $d = 0;
            ConvertToFraction($data, $n, $d);
            return $n . '/' . $d . ' ' . gettext('sec');
        }
    } else {
        return gettext('Bulb');
    }
}
Ejemplo n.º 2
0
function formatExposure($data)
{
    global $LANG_MG04;
    if ($data > 0) {
        if ($data > 1) {
            return round($data, 2) . ' ' . $LANG_MG04['sec'];
        } else {
            $n = 0;
            $d = 0;
            ConvertToFraction($data, $n, $d);
            return $n . '/' . $d . ' ' . $LANG_MG04['sec'];
        }
    } else {
        return $LANG_MG04['bulb'];
    }
}
Ejemplo n.º 3
0
function formatData($type, $tag, $intel, $data)
{
    if ($type == "ASCII") {
        //do nothing
    } else {
        if ($type == "URATIONAL" || $type == "SRATIONAL") {
            $data = bin2hex($data);
            if ($intel == 1) {
                $data = intel2Moto($data);
            }
            if ($intel == 1) {
                $top = hexdec(substr($data, 8, 8));
            } else {
                $top = hexdec(substr($data, 0, 8));
            }
            //motorola stores them top-bottom
            if ($intel == 1) {
                $bottom = hexdec(substr($data, 0, 8));
            } else {
                $bottom = hexdec(substr($data, 8, 8));
            }
            //motorola stores them top-bottom
            if ($type == "SRATIONAL" && $top > 2147483647) {
                $top = $top - 4294967296;
            }
            //this makes the number signed instead of unsigned
            if ($bottom != 0) {
                $data = $top / $bottom;
            } else {
                if ($top == 0) {
                    $data = 0;
                } else {
                    $data = $top . "/" . $bottom;
                }
            }
            if (($tag == "011a" || $tag == "011b") && $bottom == 1) {
                //XResolution YResolution
                $data = $top . " dots per ResolutionUnit";
            } else {
                if ($tag == "829a") {
                    //Exposure Time
                    if ($top / 10 == 1) {
                        $data = "1/" . round($bottom / 10, 0) . " sec";
                    } else {
                        $data = $top . "/" . $bottom . " sec";
                    }
                } else {
                    if ($tag == "829d") {
                        //FNumber
                        $data = "f " . $data;
                    } else {
                        if ($tag == "9204") {
                            //ExposureBiasValue
                            $data = $data . " EV";
                        } else {
                            if ($tag == "9205" || $tag == "9202") {
                                //ApertureValue and 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)
                                $data = exp($data * log(2) / 2);
                                $data = round($data, 1);
                                //Focal is given with a precision of 1 digit.
                                $data = "f " . $data;
                            } else {
                                if ($tag == "920a") {
                                    //FocalLength
                                    $data = $data . " mm";
                                } else {
                                    if ($tag == "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))
                                        $data = exp($data * log(2));
                                        if ($data > 1) {
                                            $data = floor($data);
                                        }
                                        //Drop the decimal.
                                        if ($data > 0) {
                                            $data = 1 / $data;
                                            //Final calculation. We now have a floating number. Transform it in a pretty number
                                            $n = 0;
                                            $d = 0;
                                            ConvertToFraction($data, $n, $d);
                                            if ($n >= 1 && $d == 1) {
                                                $data = $n . " sec";
                                            } else {
                                                $data = $n . "/" . $d . " sec";
                                            }
                                        } else {
                                            $data = "Bulb";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($type == "USHORT" || $type == "SSHORT" || $type == "ULONG" || $type == "SLONG" || $type == "FLOAT" || $type == "DOUBLE") {
                $data = bin2hex($data);
                if ($intel == 1) {
                    $data = intel2Moto($data);
                }
                if ($intel == 0 && ($type == "USHORT" || $type == "SSHORT")) {
                    $data = substr($data, 0, 4);
                }
                $data = hexdec($data);
                if ($type == "SSHORT" && $data > 32767) {
                    $data = $data - 65536;
                }
                //this makes the number signed instead of unsigned
                if ($type == "SLONG" && $data > 2147483647) {
                    $data = $data - 4294967296;
                }
                //this makes the number signed instead of unsigned
                if ($tag == "0112") {
                    //Orientation
                    if ($data == 1) {
                        $data = "Normal (O deg)";
                    }
                    if ($data == 2) {
                        $data = "Mirrored";
                    }
                    if ($data == 3) {
                        $data = "Upsidedown";
                    }
                    if ($data == 4) {
                        $data = "Upsidedown Mirrored";
                    }
                    if ($data == 5) {
                        $data = "90 deg CW Mirrored";
                    }
                    if ($data == 6) {
                        $data = "90 deg CCW";
                    }
                    if ($data == 7) {
                        $data = "90 deg CCW Mirrored";
                    }
                    if ($data == 8) {
                        $data = "90 deg CW";
                    }
                } else {
                    if ($tag == "0128" || $tag == "a210" || $tag == "0128") {
                        //ResolutionUnit and FocalPlaneResolutionUnit and ThumbnailResolutionUnit
                        if ($data == 1) {
                            $data = "No Unit";
                        }
                        if ($data == 2) {
                            $data = "Inch";
                        }
                        if ($data == 3) {
                            $data = "Centimeter";
                        }
                    } else {
                        if ($tag == "0213") {
                            //YCbCrPositioning
                            if ($data == 1) {
                                $data = "Center of Pixel Array";
                            }
                            if ($data == 2) {
                                $data = "Datum Point";
                            }
                        } else {
                            if ($tag == "8822") {
                                //ExposureProgram
                                if ($data == 1) {
                                    $data = "Manual";
                                } else {
                                    if ($data == 2) {
                                        $data = "Program";
                                    } else {
                                        if ($data == 3) {
                                            $data = "Aperature Priority";
                                        } else {
                                            if ($data == 4) {
                                                $data = "Shutter Priority";
                                            } else {
                                                if ($data == 5) {
                                                    $data = "Program Creative";
                                                } else {
                                                    if ($data == 6) {
                                                        $data = "Program Action";
                                                    } else {
                                                        if ($data == 7) {
                                                            $data = "Portrat";
                                                        } else {
                                                            if ($data == 8) {
                                                                $data = "Landscape";
                                                            } else {
                                                                $data = "Unknown: " . $data;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            } else {
                                if ($tag == "9207") {
                                    //MeteringMode
                                    if ($data == 0) {
                                        $data = "Unknown";
                                    } else {
                                        if ($data == 1) {
                                            $data = "Average";
                                        } else {
                                            if ($data == 2) {
                                                $data = "Center Weighted Average";
                                            } else {
                                                if ($data == 3) {
                                                    $data = "Spot";
                                                } else {
                                                    if ($data == 4) {
                                                        $data = "Multi-Spot";
                                                    } else {
                                                        if ($data == 5) {
                                                            $data = "Multi-Segment";
                                                        } else {
                                                            if ($data == 6) {
                                                                $data = "Partial";
                                                            } else {
                                                                if ($data == 255) {
                                                                    $data = "Other";
                                                                } else {
                                                                    $data = "Unknown: " . $data;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($tag == "9208") {
                                        //LightSource
                                        if ($data == 0) {
                                            $data = "Unknown or Auto";
                                        } else {
                                            if ($data == 1) {
                                                $data = "Daylight";
                                            } else {
                                                if ($data == 2) {
                                                    $data = "Flourescent";
                                                } else {
                                                    if ($data == 3) {
                                                        $data = "Tungsten";
                                                    } else {
                                                        if ($data == 10) {
                                                            $data = "Flash";
                                                        } else {
                                                            if ($data == 17) {
                                                                $data = "Standard Light A";
                                                            } else {
                                                                if ($data == 18) {
                                                                    $data = "Standard Light B";
                                                                } else {
                                                                    if ($data == 19) {
                                                                        $data = "Standard Light C";
                                                                    } else {
                                                                        if ($data == 20) {
                                                                            $data = "D55";
                                                                        } else {
                                                                            if ($data == 21) {
                                                                                $data = "D65";
                                                                            } else {
                                                                                if ($data == 22) {
                                                                                    $data = "D75";
                                                                                } else {
                                                                                    if ($data == 255) {
                                                                                        $data = "Other";
                                                                                    } else {
                                                                                        $data = "Unknown: " . $data;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else {
                                        if ($tag == "9209") {
                                            //Flash
                                            if ($data == 0) {
                                                $data = "No Flash";
                                            } else {
                                                if ($data == 1) {
                                                    $data = "Flash";
                                                } else {
                                                    if ($data == 5) {
                                                        $data = "Flash, strobe return light not detected";
                                                    } else {
                                                        if ($data == 7) {
                                                            $data = "Flash, strob return light detected";
                                                        } else {
                                                            if ($data == 9) {
                                                                $data = "Compulsory Flash";
                                                            } else {
                                                                if ($data == 13) {
                                                                    $data = "Compulsory Flash, Return light not detected";
                                                                } else {
                                                                    if ($data == 15) {
                                                                        $data = "Compulsory Flash, Return light detected";
                                                                    } else {
                                                                        if ($data == 16) {
                                                                            $data = "No Flash";
                                                                        } else {
                                                                            if ($data == 24) {
                                                                                $data = "No Flash";
                                                                            } else {
                                                                                if ($data == 25) {
                                                                                    $data = "Flash, Auto-Mode";
                                                                                } else {
                                                                                    if ($data == 29) {
                                                                                        $data = "Flash, Auto-Mode, Return light not detected";
                                                                                    } else {
                                                                                        if ($data == 31) {
                                                                                            $data = "Flash, Auto-Mode, Return light detected";
                                                                                        } else {
                                                                                            if ($data == 32) {
                                                                                                $data = "No Flash";
                                                                                            } else {
                                                                                                if ($data == 65) {
                                                                                                    $data = "Red Eye";
                                                                                                } else {
                                                                                                    if ($data == 69) {
                                                                                                        $data = "Red Eye, Return light not detected";
                                                                                                    } else {
                                                                                                        if ($data == 71) {
                                                                                                            $data = "Red Eye, Return light detected";
                                                                                                        } else {
                                                                                                            if ($data == 73) {
                                                                                                                $data = "Red Eye, Compulsory Flash";
                                                                                                            } else {
                                                                                                                if ($data == 77) {
                                                                                                                    $data = "Red Eye, Compulsory Flash, Return light not detected";
                                                                                                                } else {
                                                                                                                    if ($data == 79) {
                                                                                                                        $data = "Red Eye, Compulsory Flash, Return light detected";
                                                                                                                    } else {
                                                                                                                        if ($data == 89) {
                                                                                                                            $data = "Red Eye, Auto-Mode";
                                                                                                                        } else {
                                                                                                                            if ($data == 93) {
                                                                                                                                $data = "Red Eye, Auto-Mode, Return light not detected";
                                                                                                                            } else {
                                                                                                                                if ($data == 95) {
                                                                                                                                    $data = "Red Eye, Auto-Mode, Return light detected";
                                                                                                                                } else {
                                                                                                                                    $data = "Unknown: " . $data;
                                                                                                                                }
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        } else {
                                            if ($tag == "a001") {
                                                //ColorSpace
                                                if ($data == 1) {
                                                    $data = "sRGB";
                                                } else {
                                                    $data = "Uncalibrated";
                                                }
                                            } else {
                                                if ($tag == "a002" || $tag == "a003") {
                                                    //ExifImageWidth/Height
                                                    $data = $data . " pixels";
                                                } else {
                                                    if ($tag == "0103") {
                                                        //Compression
                                                        if ($data == 1) {
                                                            $data = "No Compression";
                                                        } else {
                                                            if ($data == 6) {
                                                                $data = "Jpeg Compression";
                                                            } else {
                                                                $data = "Unknown: " . $data;
                                                            }
                                                        }
                                                    } else {
                                                        if ($tag == "a217") {
                                                            //SensingMethod
                                                            if ($data == 1) {
                                                                $data = "Not defined";
                                                            }
                                                            if ($data == 2) {
                                                                $data = "One Chip Color Area Sensor";
                                                            }
                                                            if ($data == 3) {
                                                                $data = "Two Chip Color Area Sensor";
                                                            }
                                                            if ($data == 4) {
                                                                $data = "Three Chip Color Area Sensor";
                                                            }
                                                            if ($data == 5) {
                                                                $data = "Color Sequential Area Sensor";
                                                            }
                                                            if ($data == 7) {
                                                                $data = "Trilinear Sensor";
                                                            }
                                                            if ($data == 8) {
                                                                $data = "Color Sequential Linear Sensor";
                                                            } else {
                                                                $data = "Unknown: " . $data;
                                                            }
                                                        } else {
                                                            if ($tag == "0106") {
                                                                //PhotometricInterpretation
                                                                if ($data == 1) {
                                                                    $data = "Monochrome";
                                                                } else {
                                                                    if ($data == 2) {
                                                                        $data = "RGB";
                                                                    } else {
                                                                        if ($data == 6) {
                                                                            $data = "YCbCr";
                                                                        } else {
                                                                            $data = "Unknown: " . $data;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if ($type == "UNDEFINED") {
                    if ($tag == "9000" || $tag == "a000" || $tag == "0002") {
                        //ExifVersion,FlashPixVersion,InteroperabilityVersion
                        $data = "version " . $data / 100;
                    }
                    if ($tag == "a300") {
                        //FileSource
                        $data = bin2hex($data);
                        $data = str_replace("00", "", $data);
                        $data = str_replace("03", "Digital Still Camera", $data);
                    }
                    if ($tag == "a301") {
                        //SceneType
                        $data = bin2hex($data);
                        $data = str_replace("00", "", $data);
                        $data = str_replace("01", "Directly Photographed", $data);
                    }
                    if ($tag == "9101") {
                        //ComponentsConfiguration
                        $data = bin2hex($data);
                        $data = str_replace("01", "Y", $data);
                        $data = str_replace("02", "Cb", $data);
                        $data = str_replace("03", "Cr", $data);
                        $data = str_replace("04", "R", $data);
                        $data = str_replace("05", "G", $data);
                        $data = str_replace("06", "B", $data);
                        $data = str_replace("00", "", $data);
                    }
                } else {
                    $data = bin2hex($data);
                    if ($intel == 1) {
                        $data = intel2Moto($data);
                    }
                }
            }
        }
    }
    return $data;
}
Ejemplo n.º 4
0
function formatData($type, $tag, $intel, $data)
{
    if ($type == 'ASCII') {
        // Search for a null byte and stop there.
        if (($pos = strpos($data, chr(0))) !== false) {
            $data = substr($data, 0, $pos);
        }
        // Format certain kinds of strings nicely (Camera make etc.)
        if ($tag == '010f') {
            $data = ucwords(strtolower(trim($data)));
        }
    } else {
        if ($type == 'URATIONAL' || $type == 'SRATIONAL') {
            $data = bin2hex($data);
            if ($intel == 1) {
                $data = intel2Moto($data);
            }
            if ($intel == 1) {
                $top = hexdec(substr($data, 8, 8));
            } else {
                $top = hexdec(substr($data, 0, 8));
            }
            // motorola stores them top-bottom
            if ($intel == 1) {
                $bottom = hexdec(substr($data, 0, 8));
            } else {
                $bottom = hexdec(substr($data, 8, 8));
            }
            // motorola stores them top-bottom
            if ($type == 'SRATIONAL' && $top > 2147483647) {
                $top = $top - 4294967296;
            }
            // this makes the number signed instead of unsigned
            if ($bottom != 0) {
                $data = $top / $bottom;
            } else {
                if ($top == 0) {
                    $data = 0;
                } else {
                    $data = $top . '/' . $bottom;
                }
            }
            if (($tag == '011a' || $tag == '011b') && $bottom == 1) {
                // XResolution YResolution
                $data = $top . ' dots per ResolutionUnit';
            } else {
                if ($tag == '829a') {
                    // Exposure Time
                    if ($bottom % $top == 0) {
                        $data = '1/' . round($bottom / $top, 0) . ' sec';
                    } else {
                        if ($bottom == 1) {
                            $data = $top . ' sec';
                        } else {
                            $data = $top . '/' . $bottom . ' sec';
                        }
                    }
                } else {
                    if ($tag == '829d') {
                        // FNumber
                        $data = 'f/' . $data;
                    } else {
                        if ($tag == '9204') {
                            // ExposureBiasValue
                            $data = round($data, 2) . ' EV';
                        } else {
                            if ($tag == '9205' || $tag == '9202') {
                                // ApertureValue and 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)
                                $data = exp($data * log(2) / 2);
                                $data = round($data, 1);
                                // Focal is given with a precision of 1 digit.
                                $data = 'f/' . $data;
                            } else {
                                if ($tag == '920a') {
                                    // FocalLength
                                    $data = $data . ' mm';
                                } else {
                                    if ($tag == '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))
                                        $data = exp($data * log(2));
                                        if ($data > 1) {
                                            $data = floor($data);
                                        }
                                        // Drop the decimal.
                                        if ($data > 0) {
                                            $data = 1 / $data;
                                            // Final calculation. We now have a floating number. Transform it in a pretty number
                                            $n = 0;
                                            $d = 0;
                                            ConvertToFraction($data, $n, $d);
                                            if ($n >= 1 && $d == 1) {
                                                $data = $n . ' sec';
                                            } else {
                                                $data = $n . '/' . $d . ' sec';
                                            }
                                        } else {
                                            $data = 'Bulb';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($type == 'USHORT' || $type == 'SSHORT' || $type == 'ULONG' || $type == 'SLONG' || $type == 'FLOAT' || $type == 'DOUBLE') {
                $data = bin2hex($data);
                if ($intel == 1) {
                    $data = intel2Moto($data);
                }
                if ($intel == 0 && ($type == 'USHORT' || $type == 'SSHORT')) {
                    $data = substr($data, 0, 4);
                }
                $data = hexdec($data);
                if ($type == 'SSHORT' && $data > 32767) {
                    $data = $data - 65536;
                }
                // this makes the number signed instead of unsigned
                if ($type == 'SLONG' && $data > 2147483647) {
                    $data = $data - 4294967296;
                }
                // this makes the number signed instead of unsigned
                if ($tag == '0112') {
                    // Orientation
                    // Example of how all of these tag formatters should be...
                    switch ($data) {
                        case 1:
                            $data = '1: Normal (0 deg)';
                            break;
                        case 2:
                            $data = '2: Mirrored';
                            break;
                        case 3:
                            $data = '3: Upsidedown';
                            break;
                        case 4:
                            $data = '4: Upsidedown Mirrored';
                            break;
                        case 5:
                            $data = '5: 90 deg CW Mirrored';
                            break;
                        case 6:
                            $data = '6: 90 deg CCW';
                            break;
                        case 7:
                            $data = '7: 90 deg CCW Mirrored';
                            break;
                        case 8:
                            $data = '8: 90 deg CW';
                            break;
                        default:
                            $data = 'Unknown: ' . $data;
                    }
                } else {
                    if ($tag == '0128' || $tag == 'a210' || $tag == '0128') {
                        // ResolutionUnit and FocalPlaneResolutionUnit and ThumbnailResolutionUnit
                        if ($data == 1) {
                            $data = 'No Unit';
                        } else {
                            if ($data == 2) {
                                $data = 'Inch';
                            } else {
                                if ($data == 3) {
                                    $data = 'Centimeter';
                                }
                            }
                        }
                    } else {
                        if ($tag == '0213') {
                            // YCbCrPositioning
                            if ($data == 1) {
                                $data = 'Center of Pixel Array';
                            } else {
                                if ($data == 2) {
                                    $data = 'Datum Point';
                                }
                            }
                        } else {
                            if ($tag == '8822') {
                                // ExposureProgram
                                if ($data == 0) {
                                    $data = 'Not Defined';
                                } else {
                                    if ($data == 1) {
                                        $data = 'Manual';
                                    } else {
                                        if ($data == 2) {
                                            $data = 'Program';
                                        } else {
                                            if ($data == 3) {
                                                $data = 'Aperture Priority';
                                            } else {
                                                if ($data == 4) {
                                                    $data = 'Shutter Priority';
                                                } else {
                                                    if ($data == 5) {
                                                        $data = 'Program Creative';
                                                    } else {
                                                        if ($data == 6) {
                                                            $data = 'Program Action';
                                                        } else {
                                                            if ($data == 7) {
                                                                $data = 'Portrait';
                                                            } else {
                                                                if ($data == 8) {
                                                                    $data = 'Landscape';
                                                                } else {
                                                                    if ($data == 9) {
                                                                        $data = 'Blub';
                                                                    } else {
                                                                        $data = 'Unknown: ' . $data;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            } else {
                                if ($tag == '9207') {
                                    // MeteringMode
                                    if ($data == 0) {
                                        $data = 'Unknown';
                                    } else {
                                        if ($data == 1) {
                                            $data = 'Average';
                                        } else {
                                            if ($data == 2) {
                                                $data = 'Center Weighted Average';
                                            } else {
                                                if ($data == 3) {
                                                    $data = 'Spot';
                                                } else {
                                                    if ($data == 4) {
                                                        $data = 'Multi-Spot';
                                                    } else {
                                                        if ($data == 5) {
                                                            $data = 'Multi-Segment';
                                                        } else {
                                                            if ($data == 6) {
                                                                $data = 'Partial';
                                                            } else {
                                                                if ($data == 255) {
                                                                    $data = 'Other';
                                                                } else {
                                                                    $data = 'Unknown: ' . $data;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($tag == '9208') {
                                        // LightSource
                                        if ($data == 0) {
                                            $data = 'Unknown or Auto';
                                        } else {
                                            if ($data == 1) {
                                                $data = 'Daylight';
                                            } else {
                                                if ($data == 2) {
                                                    $data = 'Flourescent';
                                                } else {
                                                    if ($data == 3) {
                                                        $data = 'Tungsten';
                                                    } else {
                                                        if ($data == 4) {
                                                            $data = 'Flash';
                                                        } else {
                                                            if ($data == 9) {
                                                                $data = 'Fine Weather';
                                                            } else {
                                                                if ($data == 10) {
                                                                    $data = 'Cloudy';
                                                                } else {
                                                                    if ($data == 11) {
                                                                        $data = 'Shade';
                                                                    } else {
                                                                        if ($data == 17) {
                                                                            $data = 'Standard Light A';
                                                                        } else {
                                                                            if ($data == 18) {
                                                                                $data = 'Standard Light B';
                                                                            } else {
                                                                                if ($data == 19) {
                                                                                    $data = 'Standard Light C';
                                                                                } else {
                                                                                    if ($data == 20) {
                                                                                        $data = 'D55';
                                                                                    } else {
                                                                                        if ($data == 21) {
                                                                                            $data = 'D65';
                                                                                        } else {
                                                                                            if ($data == 22) {
                                                                                                $data = 'D75';
                                                                                            } else {
                                                                                                if ($data == 23) {
                                                                                                    $data = 'D50';
                                                                                                } else {
                                                                                                    if ($data == 24) {
                                                                                                        $data = 'ISO Studio Tungsten';
                                                                                                    } else {
                                                                                                        if ($data == 255) {
                                                                                                            $data = 'Other';
                                                                                                        } else {
                                                                                                            $data = 'Unknown: ' . $data;
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else {
                                        if ($tag == '9209') {
                                            // Flash
                                            if ($data == 0) {
                                                $data = 'No Flash';
                                            } else {
                                                if ($data == 1) {
                                                    $data = 'Flash';
                                                } else {
                                                    if ($data == 5) {
                                                        $data = 'Flash, strobe return light not detected';
                                                    } else {
                                                        if ($data == 7) {
                                                            $data = 'Flash, strob return light detected';
                                                        } else {
                                                            if ($data == 8) {
                                                                $data = 'On, Did not fire';
                                                            } else {
                                                                if ($data == 9) {
                                                                    $data = 'Compulsory Flash';
                                                                } else {
                                                                    if ($data == 13) {
                                                                        $data = 'Compulsory Flash, Return light not detected';
                                                                    } else {
                                                                        if ($data == 15) {
                                                                            $data = 'Compulsory Flash, Return light detected';
                                                                        } else {
                                                                            if ($data == 16) {
                                                                                $data = 'Off, Did not fire';
                                                                            } else {
                                                                                if ($data == 20) {
                                                                                    $data = 'Off, Did not fire, Return not detected';
                                                                                } else {
                                                                                    if ($data == 24) {
                                                                                        $data = 'Auto, Did not fire';
                                                                                    } else {
                                                                                        if ($data == 25) {
                                                                                            $data = 'Flash, Auto-Mode';
                                                                                        } else {
                                                                                            if ($data == 29) {
                                                                                                $data = 'Flash, Auto-Mode, Return light not detected';
                                                                                            } else {
                                                                                                if ($data == 31) {
                                                                                                    $data = 'Flash, Auto-Mode, Return light detected';
                                                                                                } else {
                                                                                                    if ($data == 32) {
                                                                                                        $data = 'No flash function';
                                                                                                    } else {
                                                                                                        if ($data == 48) {
                                                                                                            $data = 'Off';
                                                                                                        } else {
                                                                                                            if ($data == 65) {
                                                                                                                $data = 'Red Eye';
                                                                                                            } else {
                                                                                                                if ($data == 69) {
                                                                                                                    $data = 'Red Eye, Return light not detected';
                                                                                                                } else {
                                                                                                                    if ($data == 71) {
                                                                                                                        $data = 'Red Eye, Return light detected';
                                                                                                                    } else {
                                                                                                                        if ($data == 73) {
                                                                                                                            $data = 'Red Eye, Compulsory Flash';
                                                                                                                        } else {
                                                                                                                            if ($data == 77) {
                                                                                                                                $data = 'Red Eye, Compulsory Flash, Return light not detected';
                                                                                                                            } else {
                                                                                                                                if ($data == 79) {
                                                                                                                                    $data = 'Red Eye, Compulsory Flash, Return light detected';
                                                                                                                                } else {
                                                                                                                                    if ($data == 80) {
                                                                                                                                        $data = 'Off, Red-eye reduction';
                                                                                                                                    } else {
                                                                                                                                        if ($data == 88) {
                                                                                                                                            $data = 'Auto, Did not fire, Red-eye reduction';
                                                                                                                                        } else {
                                                                                                                                            if ($data == 89) {
                                                                                                                                                $data = 'Red Eye, Auto-Mode';
                                                                                                                                            } else {
                                                                                                                                                if ($data == 93) {
                                                                                                                                                    $data = 'Red Eye, Auto-Mode, Return light not detected';
                                                                                                                                                } else {
                                                                                                                                                    if ($data == 95) {
                                                                                                                                                        $data = 'Red Eye, Auto-Mode, Return light detected';
                                                                                                                                                    } else {
                                                                                                                                                        $data = 'Unknown: ' . $data;
                                                                                                                                                    }
                                                                                                                                                }
                                                                                                                                            }
                                                                                                                                        }
                                                                                                                                    }
                                                                                                                                }
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        } else {
                                            if ($tag == 'a001') {
                                                // ColorSpace
                                                if ($data == 1) {
                                                    $data = 'sRGB';
                                                } else {
                                                    $data = 'Uncalibrated';
                                                }
                                            } else {
                                                if ($tag == 'a002' || $tag == 'a003') {
                                                    // ExifImageWidth/Height
                                                    $data = $data . ' pixels';
                                                } else {
                                                    if ($tag == '0103') {
                                                        // Compression
                                                        if ($data == 1) {
                                                            $data = 'No Compression';
                                                        } else {
                                                            if ($data == 6) {
                                                                $data = 'Jpeg Compression';
                                                            } else {
                                                                $data = 'Unknown: ' . $data;
                                                            }
                                                        }
                                                    } else {
                                                        if ($tag == 'a217') {
                                                            // SensingMethod
                                                            if ($data == 1) {
                                                                $data = 'Not defined';
                                                            } else {
                                                                if ($data == 2) {
                                                                    $data = 'One Chip Color Area Sensor';
                                                                } else {
                                                                    if ($data == 3) {
                                                                        $data = 'Two Chip Color Area Sensor';
                                                                    } else {
                                                                        if ($data == 4) {
                                                                            $data = 'Three Chip Color Area Sensor';
                                                                        } else {
                                                                            if ($data == 5) {
                                                                                $data = 'Color Sequential Area Sensor';
                                                                            } else {
                                                                                if ($data == 7) {
                                                                                    $data = 'Trilinear Sensor';
                                                                                } else {
                                                                                    if ($data == 8) {
                                                                                        $data = 'Color Sequential Linear Sensor';
                                                                                    } else {
                                                                                        $data = 'Unknown: ' . $data;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        } else {
                                                            if ($tag == '0106') {
                                                                // PhotometricInterpretation
                                                                if ($data == 1) {
                                                                    $data = 'Monochrome';
                                                                } else {
                                                                    if ($data == 2) {
                                                                        $data = 'RGB';
                                                                    } else {
                                                                        if ($data == 6) {
                                                                            $data = 'YCbCr';
                                                                        } else {
                                                                            $data = 'Unknown: ' . $data;
                                                                        }
                                                                    }
                                                                }
                                                            } else {
                                                                if ($tag == 'a407') {
                                                                    // GainControl
                                                                    if ($data == 0) {
                                                                        $data = "None";
                                                                    }
                                                                    if ($data == 1) {
                                                                        $data = "Low gain up";
                                                                    }
                                                                    if ($data == 2) {
                                                                        $data = "High gain up";
                                                                    }
                                                                    if ($data == 3) {
                                                                        $data = "Low gain down";
                                                                    }
                                                                    if ($data == 4) {
                                                                        $data = "High gain down";
                                                                    }
                                                                } else {
                                                                    if ($tag == 'a408' || $tag == 'a409') {
                                                                        // Contrast & Saturation
                                                                        if ($data == 0) {
                                                                            $data = "Normal";
                                                                        }
                                                                        if ($data == 1) {
                                                                            $data = "Low";
                                                                        }
                                                                        if ($data == 2) {
                                                                            $data = "High";
                                                                        }
                                                                    } else {
                                                                        if ($tag == 'a40a') {
                                                                            // Sharpness
                                                                            if ($data == 0) {
                                                                                $data = "Normal";
                                                                            }
                                                                            if ($data == 1) {
                                                                                $data = "Soft";
                                                                            }
                                                                            if ($data == 2) {
                                                                                $data = "Hard";
                                                                            }
                                                                        } else {
                                                                            if ($tag == 'a402') {
                                                                                // ExposureMode
                                                                                if ($data == 0) {
                                                                                    $data = "Auto";
                                                                                }
                                                                                if ($data == 1) {
                                                                                    $data = "Manual";
                                                                                }
                                                                                if ($data == 2) {
                                                                                    $data = "Auto bracket";
                                                                                }
                                                                            } else {
                                                                                if ($tag == 'a401') {
                                                                                    // CustomRendered
                                                                                    if ($data == 0) {
                                                                                        $data = "Normal";
                                                                                    }
                                                                                    if ($data == 1) {
                                                                                        $data = "Custom";
                                                                                    }
                                                                                } else {
                                                                                    if ($tag == 'a403') {
                                                                                        // WhiteBalance
                                                                                        if ($data == 0) {
                                                                                            $data = "Auto";
                                                                                        }
                                                                                        if ($data == 1) {
                                                                                            $data = "Manual";
                                                                                        }
                                                                                    } else {
                                                                                        if ($tag == 'a406') {
                                                                                            // SceneCaptureType
                                                                                            if ($data == 0) {
                                                                                                $data = "Standard";
                                                                                            }
                                                                                            if ($data == 1) {
                                                                                                $data = "Landscape";
                                                                                            }
                                                                                            if ($data == 2) {
                                                                                                $data = "Portrait";
                                                                                            }
                                                                                            if ($data == 3) {
                                                                                                $data = "Night";
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if ($type == 'UNDEFINED') {
                    if ($tag == '9000' || $tag == 'a000' || $tag == '0002') {
                        // ExifVersion,FlashPixVersion,InteroperabilityVersion
                        $data = 'version ' . $data / 100;
                    }
                    if ($tag == 'a300') {
                        // FileSource
                        $data = bin2hex($data);
                        $data = str_replace('00', '', $data);
                        $data = str_replace('03', 'Digital Still Camera', $data);
                    }
                    if ($tag == 'a301') {
                        // SceneType
                        $data = bin2hex($data);
                        $data = str_replace('00', '', $data);
                        $data = str_replace('01', 'Directly Photographed', $data);
                    }
                    if ($tag == '9101') {
                        // ComponentsConfiguration
                        $data = bin2hex($data);
                        $data = str_replace('01', 'Y', $data);
                        $data = str_replace('02', 'Cb', $data);
                        $data = str_replace('03', 'Cr', $data);
                        $data = str_replace('04', 'R', $data);
                        $data = str_replace('05', 'G', $data);
                        $data = str_replace('06', 'B', $data);
                        $data = str_replace('00', '', $data);
                    }
                } else {
                    $data = bin2hex($data);
                    if ($intel == 1) {
                        $data = intel2Moto($data);
                    }
                }
            }
        }
    }
    return $data;
}
Ejemplo n.º 5
0
function formatExposure($data)
{
    if ($data > 0) {
        if ($data > 1) {
            return round($data, 2) . ' ' . (string) t('sec');
        } else {
            $n = 0;
            $d = 0;
            ConvertToFraction($data, $n, $d);
            return $n . '/' . $d . ' ' . (string) t('sec');
        }
    } else {
        return (string) t('Bulb');
    }
}