Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
eeb31420
Commit
eeb31420
authored
11 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
we need to be able to set the mimetype manually
parent
a1d2f0f5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/preview.php
+22
-15
22 additions, 15 deletions
lib/private/preview.php
with
22 additions
and
15 deletions
lib/private/preview.php
+
22
−
15
View file @
eeb31420
...
...
@@ -40,6 +40,7 @@ class Preview {
private
$maxX
;
private
$maxY
;
private
$scalingup
;
private
$mimetype
;
//preview images object
/**
...
...
@@ -64,6 +65,13 @@ class Preview {
* path to thumbnail if thumbnail exists
*/
public
function
__construct
(
$user
=
''
,
$root
=
'/'
,
$file
=
''
,
$maxX
=
1
,
$maxY
=
1
,
$scalingUp
=
true
)
{
//init fileviews
if
(
$user
===
''
){
$user
=
\OC_User
::
getUser
();
}
$this
->
fileView
=
new
\OC\Files\View
(
'/'
.
$user
.
'/'
.
$root
);
$this
->
userView
=
new
\OC\Files\View
(
'/'
.
$user
);
//set config
$this
->
configMaxX
=
\OC_Config
::
getValue
(
'preview_max_x'
,
null
);
$this
->
configMaxY
=
\OC_Config
::
getValue
(
'preview_max_y'
,
null
);
...
...
@@ -75,13 +83,6 @@ class Preview {
$this
->
setMaxY
(
$maxY
);
$this
->
setScalingUp
(
$scalingUp
);
//init fileviews
if
(
$user
===
''
){
$user
=
\OC_User
::
getUser
();
}
$this
->
fileView
=
new
\OC\Files\View
(
'/'
.
$user
.
'/'
.
$root
);
$this
->
userView
=
new
\OC\Files\View
(
'/'
.
$user
);
$this
->
preview
=
null
;
//check if there are preview backends
...
...
@@ -166,9 +167,16 @@ class Preview {
*/
public
function
setFile
(
$file
)
{
$this
->
file
=
$file
;
if
(
$file
!==
''
)
{
$this
->
mimetype
=
$this
->
fileView
->
getMimeType
(
$this
->
file
);
}
return
$this
;
}
public
function
setMimetype
(
$mimetype
)
{
$this
->
mimetype
=
$mimetype
;
}
/**
* @brief set the the max width of the preview
* @param int $maxX
...
...
@@ -386,11 +394,10 @@ class Preview {
}
if
(
is_null
(
$this
->
preview
))
{
$mimetype
=
$this
->
fileView
->
getMimeType
(
$file
);
$preview
=
null
;
foreach
(
self
::
$providers
as
$supportedMimetype
=>
$provider
)
{
if
(
!
preg_match
(
$supportedMimetype
,
$mimetype
))
{
if
(
!
preg_match
(
$supportedMimetype
,
$
this
->
mimetype
))
{
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment