Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
a5ae7b05
Commit
a5ae7b05
authored
Aug 28, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed missing obj and mtl in zip for _all
parent
64205f9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
download.php
download.php
+12
-9
No files found.
download.php
View file @
a5ae7b05
...
@@ -20,6 +20,7 @@ $TEXTURE_EXTENSIONS = ['png','jpeg','jpg','tif','tiff','gif'];
...
@@ -20,6 +20,7 @@ $TEXTURE_EXTENSIONS = ['png','jpeg','jpg','tif','tiff','gif'];
if
(
!
isset
(
$_GET
[
'file'
]))
die
(
"-1"
);
if
(
!
isset
(
$_GET
[
'file'
]))
die
(
"-1"
);
$file
=
$_GET
[
'file'
];
$file
=
$_GET
[
'file'
];
$filestring
=
$file
;
$patterns
=
[
'/(\.)+\//'
,
'/^\//'
];
$patterns
=
[
'/(\.)+\//'
,
'/^\//'
];
$replacements
=
[
''
,
''
];
$replacements
=
[
''
,
''
];
...
@@ -33,7 +34,11 @@ $path = $pathinfo['dirname'];
...
@@ -33,7 +34,11 @@ $path = $pathinfo['dirname'];
$tmp
=
explode
(
"/"
,
$path
);
$tmp
=
explode
(
"/"
,
$path
);
$zipfile
=
$tmp
[
1
]
.
"_"
.
$tmp
[
2
]
.
".zip"
;
if
(
$tmp
[
1
]
==
"_all"
){
$zipfile
=
$tmp
[
2
]
.
"_"
.
$tmp
[
3
]
.
".zip"
;
}
else
{
$zipfile
=
$tmp
[
1
]
.
"_"
.
$tmp
[
2
]
.
".zip"
;
}
// alright, there's this file
// alright, there's this file
$contents
=
file_get_contents
(
$file
);
$contents
=
file_get_contents
(
$file
);
...
@@ -43,20 +48,18 @@ preg_match_all('/url="([^\s]+('.implode('|',$TEXTURE_EXTENSIONS).'))"/i',$conten
...
@@ -43,20 +48,18 @@ preg_match_all('/url="([^\s]+('.implode('|',$TEXTURE_EXTENSIONS).'))"/i',$conten
// make a string
// make a string
foreach
(
$matches
[
1
]
as
$v
){
foreach
(
$matches
[
1
]
as
$v
){
$file
.=
"
$path
/
$v
"
;
$file
string
.=
"
$path
/
$v
"
;
}
}
// add obj
// add obj
$objfile
=
$path
.
"/"
.
$tmp
[
1
]
.
".
obj"
;
$objfile
=
substr
(
$file
,
0
,
-
3
)
.
"
obj"
;
if
(
is_file
(
$objfile
))
$file
.=
"
$objfile
"
;
if
(
is_file
(
$objfile
))
$file
string
.=
"
$objfile
"
;
// add mtl
// add mtl
$mtlfile
=
$path
.
"/"
.
$tmp
[
1
]
.
".mtl"
;
$mtlfile
=
substr
(
$file
,
0
,
-
3
)
.
"mtl"
;
if
(
is_file
(
$mtlfile
))
$file
.=
"
$mtlfile
"
;
if
(
is_file
(
$mtlfile
))
$filestring
.=
"
$mtlfile
"
;
$zipped_data
=
`zip -qj - $file `
;
$zipped_data
=
`zip -qj - $file
string
`
;
header
(
'Content-type: application/zip'
);
header
(
'Content-type: application/zip'
);
header
(
'Content-Disposition: attachment; filename="'
.
$zipfile
.
'"'
);
header
(
'Content-Disposition: attachment; filename="'
.
$zipfile
.
'"'
);
echo
$zipped_data
;
echo
$zipped_data
;
...
...
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