Add media subtype & fix resizing

This commit is contained in:
2019-06-30 22:21:39 +02:00
parent 73f2e6c6e4
commit e80ae81e42
4 changed files with 226 additions and 5 deletions

221
files/db/backup_v6.sql Normal file

File diff suppressed because one or more lines are too long

View File

@@ -36,7 +36,7 @@ class Media extends PhpObject {
if(empty($this->asMedias)) {
if($this->oProject->getProjectId()) {
$asMedias = $this->oDb->selectRows(array(
'select' => array(Db::getId(self::MEDIA_TABLE), 'filename', 'taken_on', 'posted_on', 'rotate'),
'select' => array(Db::getId(self::MEDIA_TABLE), 'filename', 'taken_on', 'posted_on', 'rotate', 'type AS subtype'),
'from' => self::MEDIA_TABLE,
'constraint'=> array(Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId())
));

View File

@@ -504,8 +504,8 @@ function getPost(asPost) {
case 'media':
var sTakenOn = (asPost.taken_on == '0000-00-00 00:00:00')?'':' et prise le '+asPost.taken_on_formatted+self.tmp('site_tz_notice');
var $Image = $('<img>', {'src': asPost.thumb_path, title: 'Click pour zoomer'});
var sVideo = asPost.pic_path.toLowerCase().split('.').pop()=='mov'?'true':'false';
$Body = $('<a>', {href: asPost.pic_path, 'data-video': sVideo, 'data-lightbox': 'post-pictures', 'data-title': 'Photo ajoutée le '+sAbsTime+sTakenOn, 'data-orientation': asPost.rotate}).append($Image);
var bVideo = (asPost.subtype == 'video');
$Body = $('<a>', {href: asPost.pic_path, 'data-video': (bVideo?'true':'false'), 'data-lightbox': 'post-pictures', 'data-title': (bVideo?'Vidéo':'Photo')+' ajoutée le '+sAbsTime+sTakenOn, 'data-orientation': asPost.rotate}).append($Image);
break;
case 'post':
$Body = $('<div>')

View File

@@ -325,12 +325,12 @@
if((this.videoWidth > maxVideoWidth) || (this.videoHeight > maxVideoHeight)) {
if ((this.videoWidth / maxVideoWidth) > (this.videoHeight / maxVideoHeight)) {
videoWidth = maxVideoWidth;
videoHeight = parseInt(this.videoHeight / (this.videoWidth / videoWidth), 10);
videoHeight = Math.round(this.videoHeight / (this.videoWidth / videoWidth));
$This.width(videoWidth);
$This.height(videoHeight);
} else {
videoHeight = maxVideoHeight;
videoWidth = parseInt(this.videoWidth / (this.videoHeight / videoHeight), 10);
videoWidth = Math.round(this.videoWidth / (this.videoHeight / videoHeight));
$This.width(videoWidth);
$This.height(videoHeight);
}