1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR); |
---|
3 | //if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | $plugin_path = dirname(__FILE__).'/'; |
---|
6 | |
---|
7 | include_once($plugin_path.'db_export_image_metadata_class.php'); |
---|
8 | |
---|
9 | // Template and variable init |
---|
10 | global $template; |
---|
11 | load_language('plugin.lang', $plugin_path); |
---|
12 | $destDir = ""; $exiftoolPath = ""; $exiv2path = ""; $use_exiftool = true; $use_exiv2 = true; |
---|
13 | $use_utf8 = true; $use_whole_desc = true; $nb_tags = 0; $test_mode = false; $test_img_id ='2 OR img.id = 655'; |
---|
14 | |
---|
15 | // Retrieve form |
---|
16 | if (isset($_POST['exportmetadata_post_form']) == 1) |
---|
17 | //if (isset($_POST['submit'])) |
---|
18 | { |
---|
19 | if ($_POST['exportmetadata_dir'] !== '') |
---|
20 | { |
---|
21 | $destDir = $_POST['exportmetadata_dir']; |
---|
22 | $exiv2path = realpath($_POST['exiv2_path']); |
---|
23 | $exiftoolPath = realpath($_POST['exiftool_path']); |
---|
24 | $use_exiftool = isset($_POST['use_exiftool']); //checkbox |
---|
25 | $use_exiv2 = isset($_POST['use_exiv2']); //checkbox |
---|
26 | $use_utf8 = isset($_POST['use_utf8']); //checkbox |
---|
27 | $use_whole_desc = isset($_POST['multi_lang_desc']) ? $_POST['multi_lang_desc'] === 'true' : true; |
---|
28 | $test_mode = isset($_POST['test_mode']); //checkbox |
---|
29 | $test_img_id = $_POST['test_imgid']; |
---|
30 | if (file_exists($destDir)) |
---|
31 | { |
---|
32 | $destDir = realpath($destDir); |
---|
33 | $export_image_metadata = new ExportImageMetadata($use_exiftool, $use_exiv2, $use_whole_desc, $use_utf8); |
---|
34 | $export_image_metadata->set_test_mode($test_mode, $test_img_id); |
---|
35 | $export_image_metadata->set_tool_pathes($exiftoolPath, $exiv2path); |
---|
36 | $nb_tags = $export_image_metadata->image_properties_to_file($destDir); |
---|
37 | } |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | // template assign |
---|
42 | $template->set_filenames( array('db_export_image_metadata_content' => $plugin_path.'db_export_image_metadata.tpl') ); |
---|
43 | |
---|
44 | $template->assign(array( |
---|
45 | 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin&section=Tags2File%2Fdb_export_image_metadata.php', |
---|
46 | 'EXPORTMETADATA_DIR' => $destDir, |
---|
47 | 'EXIFTOOL_PATH' => $exiftoolPath, |
---|
48 | 'EXIV2_PATH' => $exiv2path, |
---|
49 | 'USE_EXIFTOOL' => $use_exiftool ? 'checked="checked"' : '', |
---|
50 | 'USE_EXIV2' => $use_exiv2 ? 'checked="checked"' : '', |
---|
51 | 'USE_UTF8' => $use_utf8 ? 'checked="checked"' : '', |
---|
52 | 'MULTI_LANG_DESC' => $use_whole_desc ? 'true' : 'false', |
---|
53 | 'NB_FILE_TO_TAG' => $nb_tags, |
---|
54 | 'TEST_MODE' => $test_mode ? 'checked="checked"' : '', |
---|
55 | 'TEST_IMG_ID' => $test_img_id |
---|
56 | )); |
---|
57 | |
---|
58 | $template->assign_var_from_handle( 'ADMIN_CONTENT', 'db_export_image_metadata_content'); |
---|
59 | |
---|
60 | ?> |
---|