Exemple #1
0
function compare($file1, $file2)
{
    global $config;
    $file1 = escapeshellcmd($config['destination'] . $file1);
    $file2 = escapeshellcmd($config['destination'] . $file2);
    $image1 = tempnam($config['tmp_dir'], "") . ".ppm";
    $image2 = tempnam($config['tmp_dir'], "") . ".ppm";
    $diff = tempnam($config['tmp_dir'], "") . ".ppm";
    $cmd = "/home/xrosecky/projects/compare/compare -1 '{$image1}' -2 '{$image2}' '{$file1}' '{$file2}' '{$diff}'";
    $result = exec_help("compare '{$file1}' '{$file2}'", $cmd);
    $xml = simplexml_load_string($result);
    $img1 = escapeshellcmd($config['destination'] . $xml->{"image1"}->{"checksum"} . ".png");
    $img2 = escapeshellcmd($config['destination'] . $xml->{"image2"}->{"checksum"} . ".png");
    $img_diff = escapeshellcmd($config['destination'] . $xml->{"image1"}->{"checksum"} . "_" . $xml->{"image2"}->{"checksum"} . ".png");
    resize($image1, $img1);
    resize($image2, $img2);
    resize($diff, $img_diff);
    jhove($xml->{"image1"}, $file1);
    jhove($xml->{"image2"}, $file2);
    return $xml;
}
Exemple #2
0
    }
    $profiles = array();
    foreach (get_files_in_directory($config["profiles"], "xml") as $profile_file) {
        $profiles[] = $profile_file;
    }
    $smarty->assign("cputime", (string) $xml->{"cputime"});
    $smarty->assign("profiles", $profiles);
    $smarty->assign('template', 'result.tpl');
    $smarty->assign('selected', 'compare');
    $smarty->display('layout.tpl');
    // $smarty->display('result.tpl');
} else {
    if ($op == "jhove" && count($files) == 1) {
        $file1 = escapeshellcmd($config['destination'] . $files[0]);
        header("content-type: text/xml");
        $result = jhove($file1);
        //header("content-type: text/xml");
        print $result->asXML();
    } else {
        if ($op == "validate" && count($files) == 1) {
            $file1 = escapeshellcmd($config['destination'] . $files[0]);
            header("content-type: text/xml");
            $result = validate($file1);
            print $result->asXML();
        } else {
            if ($op == "jp2_profile" && count($files) == 1) {
                $file1 = escapeshellcmd($config['destination'] . $files[0]);
                $profile = $config['profiles'] . $_GET["profile"];
                header("content-type: text/xml");
                $result = jp2_profile($file1, $profile);
                header("content-type: text/xml");