mirror of
https://github.com/nextcloud/server.git
synced 2026-06-19 21:49:43 -04:00
Clean up avatars and preliminary use JSON->rawlist.php
This commit is contained in:
parent
15ab798353
commit
3774632ecc
4 changed files with 18 additions and 18 deletions
|
|
@ -32,7 +32,7 @@ class Controller {
|
|||
\OC_Response::setETagHeader(crc32($image->data()));
|
||||
$image->show();
|
||||
} else {
|
||||
\OC_JSON::success(array('user' => $user, 'size' => $size));
|
||||
\OC_JSON::success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,11 +74,9 @@ class Controller {
|
|||
\OC_JSON::error(array("data" => array("message" => "notsquare") ));
|
||||
} else {
|
||||
$l = new \OC_L10n('core');
|
||||
$type = substr($image->mimeType(), -3);
|
||||
if ($type === 'peg') {
|
||||
$type = 'jpg';
|
||||
}
|
||||
if ($type !== 'jpg' && $type !== 'png') {
|
||||
|
||||
$mimeType = $image->mimeType();
|
||||
if ($mimeType !== 'image/jpeg' && $mimeType !== 'image/png') {
|
||||
\OC_JSON::error(array("data" => array("message" => $l->t("Unknown filetype")) ));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* This plugins inserts the right avatar for the user, depending on, whether
|
||||
* he has a custom uploaded avatar, or not and show a placeholder with the
|
||||
* first letter of the users displayname instead.
|
||||
* For this it asks the core_avatar_get route, thus this plugin is fit very
|
||||
* tightly fitted for owncloud. It may not work anywhere else.
|
||||
* This plugin inserts the right avatar for the user, depending on, whether a
|
||||
* custom avatar is uploaded - which it uses then - or not, and display a
|
||||
* placeholder with the first letter of the users name instead.
|
||||
* For this it queries the core_avatar_get route, thus this plugin is fit very
|
||||
* tightly for owncloud, and it may not work anywhere else.
|
||||
*
|
||||
* You may use this on any <div></div>
|
||||
* Here I'm using <div class="avatardiv"></div> as an example.
|
||||
|
|
@ -18,18 +18,18 @@
|
|||
* There are 4 ways to call this:
|
||||
*
|
||||
* 1. $('.avatardiv').avatar('jdoe', 128);
|
||||
* This will make the div to jdoe's fitting avatar, with the size of 128px.
|
||||
* This will make the div to jdoe's fitting avatar, with a size of 128px.
|
||||
*
|
||||
* 2. $('.avatardiv').avatar('jdoe');
|
||||
* This will make the div to jdoe's fitting avatar. If the div aready has a
|
||||
* height, it will be used for the avatars size. Otherwise this plugin will
|
||||
* search for 'size' DOM data, to use it for avatar size. If neither are
|
||||
* available it will default to 64px.
|
||||
* search for 'size' DOM data, to use for avatar size. If neither are available
|
||||
* it will default to 64px.
|
||||
*
|
||||
* 3. $('.avatardiv').avatar();
|
||||
* This will search the DOM for 'user' data, to use as the username. If there
|
||||
* is no username available it will default to a placeholder with the value of
|
||||
* "x". The size will be determined the same way, as the second example did.
|
||||
* "x". The size will be determined the same way, as the second example.
|
||||
*
|
||||
* 4. $('.avatardiv').avatar('jdoe', 128, true);
|
||||
* This will behave like the first example, except it will also append random
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken;
|
||||
$.get(url, function(result) {
|
||||
if (typeof(result) === 'object') {
|
||||
$div.placeholder(result.user);
|
||||
$div.placeholder(user);
|
||||
} else {
|
||||
if (ie8fix === true) {
|
||||
$div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ input#openid, input#webdav { width:20em; }
|
|||
input#identity { width:20em; }
|
||||
#email { width: 17em; }
|
||||
|
||||
#avatar .warning { width: 350px; }
|
||||
#avatar .warning {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.msg.success{ color:#fff; background-color:#0f0; padding:3px; text-shadow:1px 1px #000; }
|
||||
.msg.error{ color:#fff; background-color:#f00; padding:3px; text-shadow:1px 1px #000; }
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ $(document).ready(function(){
|
|||
$.post(OC.Router.generate('core_avatar_post'), {path: path}, avatarResponseHandler);
|
||||
},
|
||||
false,
|
||||
"image"
|
||||
["image/png", "image/jpeg"]
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue