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
707f52f1
Commit
707f52f1
authored
11 years ago
by
Georg Ehrke
Browse files
Options
Downloads
Patches
Plain Diff
check if the imagick extension is loaded
parent
005d8e98
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/preview/svg.php
+20
-16
20 additions, 16 deletions
lib/preview/svg.php
with
20 additions
and
16 deletions
lib/preview/svg.php
+
20
−
16
View file @
707f52f1
...
...
@@ -5,25 +5,29 @@
* later.
* See the COPYING-README file.
*/
class
OC_Preview_SVG
extends
OC_Preview_Provider
{
if
(
extension_loaded
(
'imagick'
))
{
public
function
getMimeType
(){
return
'/image\/svg\+xml/'
;
}
class
OC_Preview_SVG
extends
OC_Preview_Provider
{
public
function
getMimeType
(){
return
'/image\/svg\+xml/'
;
}
public
function
getThumbnail
(
$path
,
$maxX
,
$maxY
,
$scalingup
,
$fileview
)
{
$svg
=
new
Imagick
();
$svg
->
setResolution
(
$maxX
,
$maxY
);
$svg
->
readImageBlob
(
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
.
$fileview
->
file_get_contents
(
$path
));
$svg
->
setImageFormat
(
'jpg'
);
public
function
getThumbnail
(
$path
,
$maxX
,
$maxY
,
$scalingup
,
$fileview
)
{
$svg
=
new
Imagick
();
$svg
->
setResolution
(
$maxX
,
$maxY
);
$svg
->
readImageBlob
(
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
.
$fileview
->
file_get_contents
(
$path
));
$svg
->
setImageFormat
(
'jpg'
);
//new image object
$image
=
new
\OC_Image
(
$svg
);
//check if image object is valid
if
(
!
$image
->
valid
())
return
false
;
//new image object
$image
=
new
\OC_Image
(
$svg
);
//check if image object is valid
if
(
!
$image
->
valid
())
return
false
;
return
$image
;
return
$image
;
}
}
}
OC_Preview
::
registerProvider
(
'OC_Preview_SVG'
);
\ No newline at end of file
OC_Preview
::
registerProvider
(
'OC_Preview_SVG'
);
}
\ No newline at end of file
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