[MEDIA][UI] Added preview support for BMP, WEBP and ICO, displaying the name underneath, centered

This commit is contained in:
Miguel Dantas 2019-06-15 15:16:28 +01:00 committed by Diogo Cordeiro
parent 5eb4a7d711
commit 5f53738376
2 changed files with 7 additions and 4 deletions

View File

@ -952,7 +952,8 @@ var SN = { // StatusNet
preview = false; preview = false;
} }
var imageTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/svg+xml']; var imageTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/svg+xml',
'image/bmp', 'image/webp', 'image/vnd.microsoft.icon'];
if ($.inArray(file.type, imageTypes) == -1) { if ($.inArray(file.type, imageTypes) == -1) {
// We probably don't know how to show the file. // We probably don't know how to show the file.
preview = false; preview = false;
@ -966,14 +967,16 @@ var SN = { // StatusNet
if (preview) { if (preview) {
blobAsDataURL(file, function (url) { blobAsDataURL(file, function (url) {
var fileentry = $('<li class="attachment"></li>'); var fileentry = $('<li>')
fileentry.append($('<code>' + file.name + '</code>')); .attr('class', 'attachment')
.attr('style', 'text-align: center');
var img = $('<img>') var img = $('<img>')
.attr('title', tooltip) .attr('title', tooltip)
.attr('alt', tooltip) .attr('alt', tooltip)
.attr('src', url) .attr('src', url)
.attr('style', 'height: 120px'); .attr('style', 'height: 120px');
fileentry.append(img); fileentry.append(img);
fileentry.append($('<br><code>' + file.name + '</code>'));
form.find('.attach-status').append(fileentry); form.find('.attach-status').append(fileentry);
}); });
} else { } else {

View File

@ -32,7 +32,7 @@ defined('GNUSOCIAL') || die();
define('GNUSOCIAL_ENGINE', 'GNU social'); define('GNUSOCIAL_ENGINE', 'GNU social');
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/'); define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
define('GNUSOCIAL_BASE_VERSION', '1.21.0'); define('GNUSOCIAL_BASE_VERSION', '1.21.1');
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE); define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);