fix picture orientation

This commit is contained in:
2019-05-09 19:40:45 +02:00
parent b83ea24c18
commit 94ae30e1f3
6 changed files with 21 additions and 6 deletions

View File

@@ -145,7 +145,7 @@ class Picture extends PhpObject {
$sPicPath = self::getPicPath($sPicName);
$sThumbPath = self::getPicPath($sPicName, 'thumbnail');
if(!file_exists($sThumbPath)) $asThumbInfo = ToolBox::createThumbnail($sPicPath, 400, 0, $sThumbPath/*, false, array('jpg', 'jpeg', 'gif', 'png'), true*/);
if(!file_exists($sThumbPath)) $asThumbInfo = ToolBox::createThumbnail($sPicPath, 400, 0, $sThumbPath, false, array('jpg', 'jpeg', 'gif', 'png'), false, true);
else $asThumbInfo = array('error'=>'', 'out'=>$sThumbPath);
return ($asThumbInfo['error']=='')?$asThumbInfo['out']:$sPicPath;

View File

@@ -20,7 +20,7 @@
</div>
</div>
<div id="mobile" class="mobile"></div>
<script type="text/javascript" src="script/lightbox.min.js"></script>
<script type="text/javascript" src="script/lightbox.js"></script>
<script type="text/javascript">
oSpot.onSamePageMove = function(asHash) {
if(self.tmp('first_exec')) initPage(asHash);
@@ -449,8 +449,8 @@ function getPost(asPost) {
break;
case 'picture':
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'/*, 'style':'transform:rotate('+asPost.rotate+'deg);'*/});
$Body = $('<a>', {href: asPost.pic_path, 'data-lightbox': 'post-pictures', 'data-title': 'Photo ajoutée le '+sAbsTime+sTakenOn}).append($Image);
var $Image = $('<img>', {'src': asPost.thumb_path, title: 'Click pour zoomer'});
$Body = $('<a>', {href: asPost.pic_path, 'data-lightbox': 'post-pictures', 'data-title': 'Photo ajoutée le '+sAbsTime+sTakenOn, 'data-orientation': asPost.rotate}).append($Image);
break;
case 'post':
$Body = $('<div>')

View File

@@ -215,6 +215,9 @@
alt: $link.attr('data-alt'),
link: $link.attr('href'),
title: $link.attr('data-title') || $link.attr('title')
//ADDED-START
, orientation: $link.attr('data-orientation')
//ADDED-END
});
}
@@ -294,6 +297,14 @@
$preloader = $(preloader);
//ADDED-START
if(Math.abs(self.album[imageNumber].orientation) == 90) {
var sWidth = preloader.width;
preloader.width = preloader.height;
preloader.height = sWidth;
}
//ADDED-END
$image.width(preloader.width);
$image.height(preloader.height);

View File

@@ -40,3 +40,7 @@
.lb-data .lb-close {
@include lightbox-icon(close);
}
.lb-image {
image-orientation: from-image;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long