Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
docker
osticket
Commits
eafb34d3
Unverified
Commit
eafb34d3
authored
6 years ago
by
Peter Rotich
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4721 from JediKev/issue/local-avatar-annotation
issue: Local Avatar Annotation
parents
4e5de6dc
6f2fd384
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
avatar.php
+1
-1
1 addition, 1 deletion
avatar.php
include/class.avatar.php
+17
-3
17 additions, 3 deletions
include/class.avatar.php
with
18 additions
and
4 deletions
avatar.php
+
1
−
1
View file @
eafb34d3
...
...
@@ -23,7 +23,7 @@ require_once INCLUDE_DIR . 'class.avatar.php';
try
{
$ra
=
new
RandomAvatar
(
$_GET
[
'mode'
]);
$avatar
=
$ra
->
makeAvatar
(
$_GET
[
'uid'
]);
$avatar
=
$ra
->
makeAvatar
(
$_GET
[
'uid'
]
,
$_GET
[
'size'
]
);
Http
::
response
(
200
,
false
,
'image/png'
,
false
);
Http
::
cacheable
(
$_GET
[
'uid'
],
false
,
86400
);
...
...
This diff is collapsed.
Click to expand it.
include/class.avatar.php
+
17
−
3
View file @
eafb34d3
...
...
@@ -107,12 +107,17 @@ class LocalAvatar
extends
Avatar
{
var
$mode
;
var
$code
;
var
$size
;
function
__construct
(
$user
,
$mode
)
{
parent
::
__construct
(
$user
);
$this
->
mode
=
$mode
;
}
function
setSize
(
$size
)
{
$this
->
size
=
$size
;
}
function
getUrl
(
$size
)
{
$code
=
$this
->
code
;
if
(
!
$code
&&
method_exists
(
$this
->
user
,
'getExtraAttr'
))
...
...
@@ -124,8 +129,12 @@ extends Avatar {
// Generate a random string of 0-6 chars for the avatar signature
$uid
=
md5
(
strtolower
(
$this
->
user
->
getEmail
()));
return
ROOT_PATH
.
'avatar.php?'
.
Http
::
build_query
(
array
(
'uid'
=>
$uid
,
'mode'
=>
$this
->
mode
));
$args
=
array
(
'uid'
=>
$uid
,
'mode'
=>
$this
->
mode
);
if
(
$this
->
size
)
$args
[
'size'
]
=
$this
->
size
;
return
ROOT_PATH
.
'avatar.php?'
.
Http
::
build_query
(
$args
);
}
function
toggle
()
{
...
...
@@ -152,7 +161,7 @@ class RandomAvatar {
$this
->
mode
=
$mode
;
}
function
makeAvatar
(
$uid
)
{
function
makeAvatar
(
$uid
,
$size
=
null
)
{
$sprite
=
self
::
$sprites
[
$this
->
mode
];
if
(
!
$sprite
||
!
is_readable
(
ROOT_DIR
.
$sprite
[
'file'
])
||
!
extension_loaded
(
'gd'
))
Http
::
redirect
(
ROOT_PATH
.
'images/mystery-oscar.png'
);
...
...
@@ -172,6 +181,11 @@ class RandomAvatar {
imagecopy
(
$avatar
,
$source
,
0
,
0
,
$idx
*
$grid
,
$i
*
$grid
,
$grid
,
$grid
);
}
// Resize the avatar (if applicable)
if
(
$size
)
{
$avatar
=
imagescale
(
$avatar
,
$size
,
$size
);
}
return
$avatar
;
}
}
...
...
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