Example #1
0
     chmod($uploadfile, 0644);
     $result = check_upload($_FILES['userfile']['error']);
     $filnamn = strtolower($_FILES['userfile']['name']);
     $filnamn = $time_stamp_r . $filnamn;
     $filtyp = $_FILES['userfile']['type'];
     $filstorlek = $_FILES['userfile']['size'];
     $status = "ok";
     //Get the exif data so we can store it.
     // what about files that don't have exif data??
     include_once '../includes/functions_exif.php';
     $exif_info_db = serialize_exif($uploadfile);
     if ($postdatefromexif == true) {
         // since we all ready escaped everything for database commit we have
         // strip the slashes before we can use the exif again.
         $exif_info = stripslashes($exif_info_db);
         $exif_result = unserialize_exif($exif_info);
         $exposuredatetime = $exif_result['DateTimeOriginalSubIFD'];
         if ($exposuredatetime != '') {
             list($exifyear, $exifmonth, $exifday, $exifhour, $exifmin, $exifsec) = split('[: ]', $exposuredatetime);
             $datetime = date("Y-m-d H:i:s", mktime($exifhour, $exifmin, $exifsec, $exifmonth, $exifday, $exifyear));
         } else {
             $datetime = gmdate("Y-m-d H:i:s", time() + 3600 * $tz);
         }
     }
     // NEW WORKSPACE ADDED
     eval_addon_admin_workspace_menu('image_upload_succesful');
 } else {
     // something went wrong, try to describe what
     if ($_FILES['userfile']['error'] != '0') {
         $result = check_upload($_FILES['userfile']['error']);
     } else {
Example #2
0
function replace_exif_tags($language_full, $image_exif, $tpl)
{
    global $cfgrow;
    // get exif
    $exif_result = unserialize_exif($image_exif);
    // get the language stuff
    require "language/lang-" . $language_full . ".php";
    if ($exif_result !== null) {
        $empty_exif = "N/A";
        if (array_key_exists("ExposureTimeSubIFD", $exif_result)) {
            $exposure = $exif_result['ExposureTimeSubIFD'];
            // exposure time
        } else {
            $exposure = $empty_exif;
        }
        if (isset($exposure) && $exposure != "") {
            $exposure = reduceExif($exposure);
            $exposure = "{$exposure} sec";
        }
        if (array_key_exists("FNumberSubIFD", $exif_result)) {
            $aperture = $exif_result['FNumberSubIFD'];
            // Aperture
            $aperture = round(trim($aperture, ' f'), 1);
            $aperture = "f/{$aperture}";
        } else {
            $aperture = $empty_exif;
        }
        if (array_key_exists("DateTimeOriginalSubIFD", $exif_result)) {
            $exif_result['DateTimeOriginalSubIFD'] = trim(str_replace('-', ':', $exif_result['DateTimeOriginalSubIFD']));
            $exif_result['DateTimeOriginalSubIFD'] = str_replace(' ', ':', $exif_result['DateTimeOriginalSubIFD']);
            $ftime = explode(":", $exif_result['DateTimeOriginalSubIFD']);
            $unxTimestamp = mktime($ftime[3], $ftime[4], $ftime[5], $ftime[1], $ftime[2], $ftime[0]);
            $capture_date = date($cfgrow['dateformat'], $unxTimestamp);
        } else {
            $capture_date = $empty_exif;
        }
        if (array_key_exists("FlashSubIFD", $exif_result)) {
            $flash = $exif_result['FlashSubIFD'];
            // flash
        } else {
            $flash = null;
        }
        if (array_key_exists("FocalLengthSubIFD", $exif_result)) {
            $focal = $exif_result['FocalLengthSubIFD'];
            // focal length
        } else {
            $focal = $empty_exif;
        }
        if (array_key_exists("MakeIFD0", $exif_result)) {
            $info_camera_manu = trim($exif_result['MakeIFD0']);
            // camera maker
        } else {
            $info_camera_manu = $empty_exif;
        }
        if (array_key_exists("ModelIFD0", $exif_result)) {
            $info_camera_model = trim($exif_result['ModelIFD0']);
            // camera model
        } else {
            $info_camera_model = $empty_exif;
        }
        if (array_key_exists("ISOSpeedRatingsSubIFD", $exif_result)) {
            $iso = trim($exif_result['ISOSpeedRatingsSubIFD']);
            //
        } else {
            $iso = $empty_exif;
        }
        if (isset($flash) && $flash == "No Flash") {
            $flash = "{$lang_flash_not_fired}";
        } elseif (isset($flash) && $flash) {
            $flash = "{$lang_flash_fired}";
        } else {
            $flash = "{$lang_flash_not_detected}";
        }
        if (isset($exposure) && $exposure != "0") {
            $exposure = "{$exposure}";
            $tpl = ereg_replace("<EXIF_EXPOSURE_TIME>", $exposure, $tpl);
        } else {
            $exposure = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_EXPOSURE_TIME>", $exposure, $tpl);
        }
        $langexposure = "{$lang_exposure} {$exposure}";
        $tpl = ereg_replace("<LANG_EXPOSURE_TIME>", $langexposure, $tpl);
        if (isset($aperture) && $aperture != "") {
            $tpl = ereg_replace("<EXIF_APERTURE>", $aperture, $tpl);
        } else {
            $aperture = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_APERTURE>", $aperture, $tpl);
        }
        $langaperture = "{$lang_aperture} {$aperture}";
        $tpl = ereg_replace("<LANG_APERTURE>", $langaperture, $tpl);
        if (isset($capture_date) && $capture_date != "") {
            $tpl = ereg_replace("<EXIF_CAPTURE_DATE>", $capture_date, $tpl);
        } else {
            $capture_date = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_CAPTURE_DATE>", $capture_date, $tpl);
        }
        $langcapture_date = "{$lang_capture_date} {$capture_date}";
        $tpl = ereg_replace("<LANG_CAPTURE_DATE>", $langcapture_date, $tpl);
        if (isset($focal) && $focal != "") {
            $tpl = ereg_replace("<EXIF_FOCAL_LENGTH>", $focal, $tpl);
        } else {
            $focal = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_FOCAL_LENGTH>", $focal, $tpl);
        }
        $langfocal = "{$lang_focal} {$focal}";
        $tpl = ereg_replace("<LANG_FOCAL_LENGTH>", $langfocal, $tpl);
        if (isset($info_camera_manu) && $info_camera_manu != "") {
            $tpl = ereg_replace("<EXIF_CAMERA_MAKE>", $info_camera_manu, $tpl);
        } else {
            $info_camera_manu = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_CAMERA_MAKE>", $info_camera_manu, $tpl);
        }
        $langcamera_manu = "{$lang_camera_maker} {$info_camera_manu}";
        $tpl = ereg_replace("<LANG_CAMERA_MAKE>", $langcamera_manu, $tpl);
        if (isset($info_camera_model) && $info_camera_model != "") {
            $tpl = ereg_replace("<EXIF_CAMERA_MODEL>", $info_camera_model, $tpl);
        } else {
            $info_camera_model = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_CAMERA_MODEL>", $info_camera_model, $tpl);
        }
        $langcamera_model = "{$lang_camera_model} {$info_camera_model}";
        $tpl = ereg_replace("<LANG_CAMERA_MODEL>", $langcamera_model, $tpl);
        if (isset($iso) && $iso != "") {
            $tpl = ereg_replace("<EXIF_ISO>", $iso, $tpl);
            $iso = "{$iso}";
        } else {
            $iso = "{$empty_exif}";
            $tpl = ereg_replace("<EXIF_ISO>", $iso, $tpl);
        }
        $langiso = "{$lang_iso} {$iso}";
        $tpl = ereg_replace("<LANG_ISO>", $langiso, $tpl);
        $flash = "{$flash}";
        $tpl = ereg_replace("<EXIF_FLASH>", $flash, $tpl);
    }
    return $tpl;
}
    //Gets the id of the last added image to use in the next "insert"
} elseif ($_GET['x'] == 'update') {
    $query = "UPDATE " . $pixelpost_db_prefix . "pixelpost set \n\t\tdatetime='{$newdatetime}', headline='{$headline}', body='{$body}', \n\t\tcategory='{$category}', alt_headline='{$alt_headline}', \n\t\talt_body='{$alt_body}', comments='{$comments_settings}', \n\t\texif_info='{$exif_info_db}' \n\t\tWHERE id='{$update_id}'";
    $result = mysql_query($query) || die_logout("Error: " . mysql_error() . $admin_lang_ni_db_error);
}
/**
 * Support for the GooglemapAddon
 * 
 * since we all ready escaped everything for database commit we have
 * strip the slashes before we can use the exif again.
 * 
 * Not sure how the update is handled in this routine!!
 * TODO: check update routine.
 **/
$exif_info = stripslashes($exif_info_db);
$exif_info = unserialize_exif($exif_info);
// try to get the GPS exif data
if (array_key_exists('LatitudeGPS', $exif_info)) {
    $_POST['imagePointLat'] = $exif_info['Latitude ReferenceGPS'] == "S" ? '-' . $exif_info['LatitudeGPS'] : $exif_info['LatitudeGPS'];
    $_POST['imagePointLng'] = $exif_info['Longitude ReferenceGPS'] == "W" ? '-' . $exif_info['LongitudeGPS'] : $exif_info['LongitudeGPS'];
    // add backwards compatibility with GooglemapAddon v2
    $_POST['imagePoint'] = "({$_POST['imagePointLat']},{$_POST['imagePointLng']})";
}
/**
 * Support for categories
 **/
if (isset($_POST['category'])) {
    if ($_GET['x'] == 'update') {
        // remove the categories from the table so we can insert them again
        $query = "delete from " . $pixelpost_db_prefix . "catassoc where image_id='{$getid}'";
        $result = mysql_query($query) || "Error: " . mysql_error();