예제 #1
0
/**
 * Write the IPCT date to an image
 *
 * @global type $UNC_GALLERY
 * @param type $file_path
 * @param type $date_str
 */
function unc_ipct_date_write($file_path, $date_str)
{
    global $UNC_GALLERY;
    if ($UNC_GALLERY['debug']) {
        XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    }
    // convert date_str to IPCT
    $search_pattern = '/(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d)/';
    $date_pattern = '$1$2$3';
    $ipct_date = preg_replace($search_pattern, $date_pattern, $date_str);
    $time_pattern = '$4$5$6';
    $ipct_time = preg_replace($search_pattern, $time_pattern, $date_str);
    if ($UNC_GALLERY['debug']) {
        XMPP_ERROR_trace('will write IPCT date in format', "{$ipct_date} / {$ipct_time}");
    }
    // write IPICT Date / time
    $taget_ipct_obj = new iptc($file_path);
    $taget_ipct_obj->set('created_date', $ipct_date);
    $taget_ipct_obj->set('created_time', $ipct_time);
    $taget_ipct_obj->write();
}
예제 #2
0
<?php

session_start();
if ($_SESSION['hash'] != $_POST['hash']) {
    die("error::Session expired!");
}
// $_POST["caption"]="Test caption";
// $_POST["city"]="city";
// $_POST["location"]="25346526876976";
$caption = $_POST["caption"];
//$iptc["2#120"][0];// 2000 chars
$city = $_POST["city"];
//$iptc["2#090"][0];// 32 chars
$location = $_POST["location"];
//$iptc["2#092"][0];//
$path = "../../" . $_POST["path"];
//"../../../photos/Portraits/20090408-2.jpg";//20090704_003129.jpg";//
DEFINE('IPTC_CITY', '090');
DEFINE('IPTC_GLOBAL_POSITION', '092');
DEFINE('IPTC_CAPTION', '120');
include "iptc.php";
$i = new iptc($path);
$i->set(IPTC_CAPTION, $caption);
$i->set(IPTC_CITY, $city);
$i->set(IPTC_GLOBAL_POSITION, $location);
echo $i->write();