Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
ec51825d
Commit
ec51825d
authored
Nov 13, 2013
by
Thomas Tanghus
Browse files
Use dedicated OC_Image loader methods
This prevents excessive logging and disk access
parent
dc300560
Changes
5
Hide whitespace changes
Inline
Side-by-side
lib/private/preview/image.php
View file @
ec51825d
...
...
@@ -21,11 +21,11 @@ class Image extends Provider {
return
false
;
}
$image
=
new
\
OC_Image
();
//check if file is encrypted
if
(
$fileInfo
[
'encrypted'
]
===
true
)
{
$image
=
new
\
OC_Image
(
stream_get_contents
(
$fileview
->
fopen
(
$path
,
'r'
)));
$image
->
loadFromData
(
stream_get_contents
(
$fileview
->
fopen
(
$path
,
'r'
)));
}
else
{
$image
=
new
\
OC_Image
();
$image
->
loadFromFile
(
$fileview
->
getLocalFile
(
$path
));
}
...
...
lib/private/preview/movies.php
View file @
ec51825d
...
...
@@ -36,7 +36,8 @@ if (!\OC_Util::runningOnWindows()) {
shell_exec
(
$cmd
);
$image
=
new
\
OC_Image
(
$tmpPath
);
$image
=
new
\
OC_Image
();
$image
->
loadFromFile
(
$tmpPath
);
unlink
(
$absPath
);
unlink
(
$tmpPath
);
...
...
lib/private/preview/mp3.php
View file @
ec51825d
...
...
@@ -25,7 +25,8 @@ class MP3 extends Provider {
if
(
isset
(
$tags
[
'id3v2'
][
'APIC'
][
0
][
'data'
]))
{
$picture
=
@
$tags
[
'id3v2'
][
'APIC'
][
0
][
'data'
];
unlink
(
$tmpPath
);
$image
=
new
\
OC_Image
(
$picture
);
$image
=
new
\
OC_Image
();
$image
->
loadFromData
(
$picture
);
return
$image
->
valid
()
?
$image
:
$this
->
getNoCoverThumbnail
();
}
...
...
@@ -39,7 +40,8 @@ class MP3 extends Provider {
return
false
;
}
$image
=
new
\
OC_Image
(
$icon
);
$image
=
new
\
OC_Image
();
$image
->
loadFromFile
(
$icon
);
return
$image
->
valid
()
?
$image
:
false
;
}
...
...
lib/private/preview/office-cl.php
View file @
ec51825d
...
...
@@ -48,7 +48,8 @@ if (!\OC_Util::runningOnWindows()) {
return
false
;
}
$image
=
new
\
OC_Image
(
$pdf
);
$image
=
new
\
OC_Image
();
$image
->
loadFromData
(
$pdf
);
unlink
(
$absPath
);
unlink
(
$absPath
.
'.pdf'
);
...
...
lib/private/preview/office-fallback.php
View file @
ec51825d
...
...
@@ -80,7 +80,8 @@ class MSOfficeExcel extends Provider {
unlink
(
$absPath
);
unlink
(
$tmpPath
);
$image
=
new
\
OC_Image
(
$pdf
);
$image
=
new
\
OC_Image
();
$image
->
loadFromData
(
$pdf
);
return
$image
->
valid
()
?
$image
:
false
;
}
...
...
Write
Preview
Supports
Markdown
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