Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-tools-x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-tools-x393
Commits
645729cc
Commit
645729cc
authored
Jul 26, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixing on chunk edges, added optional debug
parent
8040cfa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
extract_images_tiff.php
extract_images_tiff.php
+17
-4
No files found.
extract_images_tiff.php
View file @
645729cc
...
...
@@ -32,9 +32,8 @@ Found problem - does not process files that start in one file and end in another
define
(
'MIN_JP_LEN'
,
0x500
);
// skip from jpeg looking for end marker
define
(
'MAX_IMG_LEN'
,
0x1000000
);
// maximal image size (16M) to look for the end marker
define
(
'REQUIRE_EXIF'
,
1
);
// JPEG/JP4 must have Exif (more filtering, less false positives)
//define('DEBUG_LEVEL',
3); // Generate debug output
define
(
'DEBUG_LEVEL'
,
0
);
//
3); // Generate debug output
//define('DEBUG_OUT_FILES',DEBUG_LEVEL? 1 : 0 ); // 1 to add sequence number to result image names (make all unique)
define
(
'DEBUG_LEVEL'
,
1
);
// Generate debug output
define
(
'DEBUG_OUT_FILES'
,
DEBUG_LEVEL
?
0
:
0
);
// 1 to add sequence number to result image names (make all unique)
//disable the default time limit for php scripts.
set_time_limit
(
0
);
...
...
@@ -270,6 +269,9 @@ function split_file($path, $file, $destination, $add_to_chn = - 1, $next_file =
}
}
fseek
(
$f
,
$markers
[
$i
]);
if
((
DEBUG_LEVEL
>=
1
))
{
printf
(
"marker: %6d, position 0x%x
\n
"
,
$i
,
$markers
[
$i
]);
}
$s
=
fread
(
$f
,
$markers
[
$i
+
1
]
-
$markers
[
$i
]);
if
((
DEBUG_LEVEL
>=
2
))
{
if
((
$i
==
(
count
(
$markers
)
-
2
))
||
(
$i
==
0
))
{
...
...
@@ -313,7 +315,18 @@ function split_file($path, $file, $destination, $add_to_chn = - 1, $next_file =
}
}
else
if
(
$file_type
==
1
)
{
// Tiff
// file_put_contents($tmp_name,$s);
// read continuation if needed
//$s = fread($f, $markers[$i + 1] - $markers[$i]);
if
((
strlen
(
$s
)
<
$markers
[
$i
+
1
]
-
$markers
[
$i
])
&&
$next_path
)
{
$f1
=
fopen
(
$next_path
,
"r"
);
$s
.=
fread
(
$f1
,
$markers
[
$i
+
1
]
-
$markers
[
$i
]
-
strlen
(
$s
));
// beginning of the next file
fclose
(
$f1
);
if
(
DEBUG_LEVEL
>=
0
)
{
printf
(
"Got continuation of the image from the next file %s
\n
"
,
$next_path
);
}
}
// file_put_contents($tmp_name,$s);
file_put_contents
(
$tmp_name
,
substr
(
$s
,
0
,
MAX_HEAD_LEN
));
// only save beginning of the file
// printf ("header length = %d\n", strlen(substr($s, 0, MAX_HEAD_LEN)));
$result_name
=
elphel_specific_result_name
(
$tmp_name
,
$image_length
,
$add_to_chn
);
...
...
@@ -328,7 +341,7 @@ function split_file($path, $file, $destination, $add_to_chn = - 1, $next_file =
}
// rename($tmp_name, $dest_image); // "$path/$destination/$result_name");
file_put_contents
(
$dest_image
,
substr
(
$s
,
0
,
$image_length
));
if
(
(
DEBUG_LEVEL
>=
2
)
)
{
if
(
DEBUG_LEVEL
>=
2
)
{
if
(
$i
==
0
)
{
file_put_contents
(
$dest_image
.
".test"
,
substr
(
$s
,
0
,
$image_length
));
printf
(
"2.First image[%d] from img file - %s, length=0x%08x(%d), strlen(s)=%d (%d)
\n
"
,
$i
,
$dest_image
,
$image_length
,
$image_length
,
strlen
(
$s
),
strlen
(
substr
(
$s
,
0
,
$image_length
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment