Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
df1cc94c
Unverified
Commit
df1cc94c
authored
8 years ago
by
Thomas Müller
Committed by
Lukas Reschke
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Some cleanup within OC_Image (#25875)
parent
3647fbe7
No related branches found
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/private/legacy/image.php
+11
-15
11 additions, 15 deletions
lib/private/legacy/image.php
with
11 additions
and
15 deletions
lib/private/legacy/image.php
+
11
−
15
View file @
df1cc94c
...
@@ -84,11 +84,6 @@ class OC_Image implements \OCP\IImage {
...
@@ -84,11 +84,6 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
=
\OC
::
$server
->
getLogger
();
$this
->
logger
=
\OC
::
$server
->
getLogger
();
}
}
if
(
!
extension_loaded
(
'gd'
)
||
!
function_exists
(
'gd_info'
))
{
$this
->
logger
->
error
(
__METHOD__
.
'(): GD module not installed'
,
array
(
'app'
=>
'core'
));
return
false
;
}
if
(
\OC_Util
::
fileInfoLoaded
())
{
if
(
\OC_Util
::
fileInfoLoaded
())
{
$this
->
fileInfo
=
new
finfo
(
FILEINFO_MIME_TYPE
);
$this
->
fileInfo
=
new
finfo
(
FILEINFO_MIME_TYPE
);
}
}
...
@@ -802,8 +797,8 @@ class OC_Image implements \OCP\IImage {
...
@@ -802,8 +797,8 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
return
false
;
return
false
;
}
}
$widthOrig
=
image
SX
(
$this
->
resource
);
$widthOrig
=
image
sx
(
$this
->
resource
);
$heightOrig
=
image
SY
(
$this
->
resource
);
$heightOrig
=
image
sy
(
$this
->
resource
);
$ratioOrig
=
$widthOrig
/
$heightOrig
;
$ratioOrig
=
$widthOrig
/
$heightOrig
;
if
(
$ratioOrig
>
1
)
{
if
(
$ratioOrig
>
1
)
{
...
@@ -828,8 +823,8 @@ class OC_Image implements \OCP\IImage {
...
@@ -828,8 +823,8 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
return
false
;
return
false
;
}
}
$widthOrig
=
image
SX
(
$this
->
resource
);
$widthOrig
=
image
sx
(
$this
->
resource
);
$heightOrig
=
image
SY
(
$this
->
resource
);
$heightOrig
=
image
sy
(
$this
->
resource
);
$process
=
imagecreatetruecolor
(
$width
,
$height
);
$process
=
imagecreatetruecolor
(
$width
,
$height
);
if
(
$process
==
false
)
{
if
(
$process
==
false
)
{
...
@@ -867,8 +862,8 @@ class OC_Image implements \OCP\IImage {
...
@@ -867,8 +862,8 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
->
error
(
'OC_Image->centerCrop, No image loaded'
,
array
(
'app'
=>
'core'
));
$this
->
logger
->
error
(
'OC_Image->centerCrop, No image loaded'
,
array
(
'app'
=>
'core'
));
return
false
;
return
false
;
}
}
$widthOrig
=
image
SX
(
$this
->
resource
);
$widthOrig
=
image
sx
(
$this
->
resource
);
$heightOrig
=
image
SY
(
$this
->
resource
);
$heightOrig
=
image
sy
(
$this
->
resource
);
if
(
$widthOrig
===
$heightOrig
and
$size
==
0
)
{
if
(
$widthOrig
===
$heightOrig
and
$size
==
0
)
{
return
true
;
return
true
;
}
}
...
@@ -967,8 +962,8 @@ class OC_Image implements \OCP\IImage {
...
@@ -967,8 +962,8 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
return
false
;
return
false
;
}
}
$widthOrig
=
image
SX
(
$this
->
resource
);
$widthOrig
=
image
sx
(
$this
->
resource
);
$heightOrig
=
image
SY
(
$this
->
resource
);
$heightOrig
=
image
sy
(
$this
->
resource
);
$ratio
=
$widthOrig
/
$heightOrig
;
$ratio
=
$widthOrig
/
$heightOrig
;
$newWidth
=
min
(
$maxWidth
,
$ratio
*
$maxHeight
);
$newWidth
=
min
(
$maxWidth
,
$ratio
*
$maxHeight
);
...
@@ -990,8 +985,8 @@ class OC_Image implements \OCP\IImage {
...
@@ -990,8 +985,8 @@ class OC_Image implements \OCP\IImage {
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
$this
->
logger
->
error
(
__METHOD__
.
'(): No image loaded'
,
array
(
'app'
=>
'core'
));
return
false
;
return
false
;
}
}
$widthOrig
=
image
SX
(
$this
->
resource
);
$widthOrig
=
image
sx
(
$this
->
resource
);
$heightOrig
=
image
SY
(
$this
->
resource
);
$heightOrig
=
image
sy
(
$this
->
resource
);
if
(
$widthOrig
>
$maxWidth
||
$heightOrig
>
$maxHeight
)
{
if
(
$widthOrig
>
$maxWidth
||
$heightOrig
>
$maxHeight
)
{
return
$this
->
fitIn
(
$maxWidth
,
$maxHeight
);
return
$this
->
fitIn
(
$maxWidth
,
$maxHeight
);
...
@@ -1024,6 +1019,7 @@ if (!function_exists('imagebmp')) {
...
@@ -1024,6 +1019,7 @@ if (!function_exists('imagebmp')) {
* @link http://www.programmierer-forum.de/imagebmp-gute-funktion-gefunden-t143716.htm
* @link http://www.programmierer-forum.de/imagebmp-gute-funktion-gefunden-t143716.htm
* @author mgutt <marc@gutt.it>
* @author mgutt <marc@gutt.it>
* @version 1.00
* @version 1.00
* @param resource $im
* @param string $fileName [optional] <p>The path to save the file to.</p>
* @param string $fileName [optional] <p>The path to save the file to.</p>
* @param int $bit [optional] <p>Bit depth, (default is 24).</p>
* @param int $bit [optional] <p>Bit depth, (default is 24).</p>
* @param int $compression [optional]
* @param int $compression [optional]
...
...
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