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
mahara
mahara
Commits
a4cf5280
Commit
a4cf5280
authored
Nov 25, 2011
by
Richard Mansfield
Committed by
Gerrit Code Review
Nov 25, 2011
Browse files
Merge "Check mimetype when bits per pixel not returned by gd (bug #784978)"
parents
a2b44542
a7d5e2fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/file.php
View file @
a4cf5280
...
@@ -527,8 +527,14 @@ function get_dataroot_image_path($path, $id, $size=null) {
...
@@ -527,8 +527,14 @@ function get_dataroot_image_path($path, $id, $size=null) {
// gd can eat a lot of memory shrinking large images, so use a placeholder image
// gd can eat a lot of memory shrinking large images, so use a placeholder image
// here if necessary
// here if necessary
if
(
isset
(
$imageinfo
[
0
])
&&
isset
(
$imageinfo
[
1
])
&&
isset
(
$imageinfo
[
'bits'
]))
{
if
(
isset
(
$imageinfo
[
'bits'
]))
{
$approxmem
=
$imageinfo
[
0
]
*
$imageinfo
[
1
]
*
(
$imageinfo
[
'bits'
]
/
8
)
$bits
=
$imageinfo
[
'bits'
];
}
else
if
(
$imageinfo
[
'mime'
]
==
'image/gif'
)
{
$bits
=
8
;
}
if
(
isset
(
$imageinfo
[
0
])
&&
isset
(
$imageinfo
[
1
])
&&
!
empty
(
$bits
))
{
$approxmem
=
$imageinfo
[
0
]
*
$imageinfo
[
1
]
*
(
$bits
/
8
)
*
(
isset
(
$imageinfo
[
'channels'
])
?
$imageinfo
[
'channels'
]
:
3
);
*
(
isset
(
$imageinfo
[
'channels'
])
?
$imageinfo
[
'channels'
]
:
3
);
}
}
if
(
empty
(
$approxmem
)
||
$approxmem
>
get_config
(
'maximageresizememory'
))
{
if
(
empty
(
$approxmem
)
||
$approxmem
>
get_config
(
'maximageresizememory'
))
{
...
...
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