Ejemplo n.º 1
0
 $uploadfile = $upload_dir . $time_stamp_r . $userfile;
 // NEW WORKSPACE ADDED
 eval_addon_admin_workspace_menu('image_upload_start');
 if (getimagesize($_FILES['userfile']['tmp_name'])) {
     if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
         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');
Ejemplo n.º 2
0
/*				configuration variables				*/
/****************************************************/
$addon_name = "Update EXIF";
$addon_version = "0.2";
$addon_description = "Since Pixelpost 1.6 the old behaviour of reading the EXIF files from the images upon loading is replaced by saving the EXIF in the database during the upload of an image.\n\tThis will speed up loading time and will solve issues reported with the EXIF data. Please note you can turn the EXIF data off, this will effect the way the EXIF tags are replaced. EXIF data will always be saved in the database.\n\t<br /><br />\n\tThis addon provides an easy way to extract the EXIF from the images and save it to the database so the old pictures are compatible with the new EXIF functions.\n\t<br /><br />\n\tPlease note: using the button 'Remove EXIF' will remove all EXIF data for all images from the database. You can use the 'Update EXIF' button to get the EXIF again from the uploaded files.\n\t<br /><br />";
/***********************/
/* ADDON CODE (action) */
/***********************/
if (isset($_POST['Action']) && $_POST['Action'] == "Update EXIF") {
    // select all the images with no EXIF
    include_once '../includes/functions_exif.php';
    $counter = 0;
    $query = "SELECT id,image FROM " . $pixelpost_db_prefix . "pixelpost WHERE exif_info IS NULL";
    $sql = mysql_query($query) or die("db error");
    while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) {
        $exif_info_db = serialize_exif($cfgrow['imagepath'] . $row['image']);
        $id = $row['id'];
        mysql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info='{$exif_info_db}' where id='{$id}'");
        $counter = $counter + 1;
    }
    $Exif_Msg = "<font color=\"blue\">Updated exif from " . $counter . " images.</font>";
}
if (isset($_POST['Action']) && $_POST['Action'] == "Remove EXIF") {
    // remove EXIF from all images
    include_once '../includes/functions_exif.php';
    mysql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info=NULL");
    $Exif_Msg = "<font color=\"blue\">Removed exif from " . $counter . " images.</font>";
}
/**************************/
/* ADDON CODE (Show Form) */
/**************************/
Ejemplo n.º 3
0
             //Gets the id of the last added image to use in the next "insert"
             if (isset($_POST['category'])) {
                 foreach ($_POST['category'] as $val) {
                     $query = "INSERT INTO " . $pixelpost_db_prefix . "catassoc(id,cat_id,image_id) VALUES(NULL,'" . mysql_real_escape_string($val) . "','{$theid}')";
                     $result = mysql_query($query);
                     if (mysql_error()) {
                         $Errors .= "Insert categories to db error: " . mysql_error() . "<br/>";
                         $errored = TRUE;
                     }
                 }
                 // end foreach
             }
             // end if isset
             // update the exif in the database
             include_once '../includes/functions_exif.php';
             $exif_info_db = serialize_exif($cfgrow['imagepath'] . $newfile);
             mysql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info='{$exif_info_db}' where id='{$theid}'");
             if (mysql_error()) {
                 $Errors .= "Insert EXIF information to db error: " . mysql_error() . "<br/>";
                 $errored = TRUE;
             }
             // create thumbnail  too
             createthumbnail($newfile);
         }
         // if copy done
     } else {
         //someone is trying to copy a file that is not an image. Ignore it.
     }
 }
 // end foreach
 $Errors .= "</div>";