1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/view/managerVideosLight_image.php
Daniel 2a9630258f https://github.com/WWBN/AVideo/issues/6345#issuecomment-1067056556
Also check the lang in case insensitive
2022-03-14 14:28:38 -03:00

64 lines
No EOL
1.9 KiB
PHP

<?php
$images = Video::getImageFromID($videos_id);
if (isMobile()) {
$viewportWidth = 250;
} else {
$viewportWidth = 800;
}
if (defaultIsPortrait()) {
$width = 540;
$height = 800;
$path = $images->posterPortraitPath;
$portreait = 1;
} else {
$width = 1280;
$height = 720;
$path = empty($images->posterLandscapePath) ? "{$global['systemRootPath']}view/img/notfound.jpg" : $images->posterLandscapePath;
$portreait = 0;
}
$image = str_replace([$global['systemRootPath'], DIRECTORY_SEPARATOR], [$global['webSiteRootURL'], '/'], $path);
$image = addQueryStringParameter($image, 'cache', filectime($path));
//var_dump($image, $images);exit;
$croppie1 = getCroppie(__("Upload Poster"), "saveVideo", $width, $height, $viewportWidth);
echo $croppie1['html'];
?>
<hr>
<button class="btn btn-success btn-lg btn-block" onclick="closeWindowAfterImageSave=true;<?php echo $croppie1['getCroppieFunction']; ?>"><i class="fas fa-save"></i> <?php echo __('Save'); ?></button>
<script>
var closeWindowAfterImageSave = false;
function saveVideo(image) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/videoEditLight.php',
data: {
videos_id: <?php echo $videos_id; ?>,
image: image,
portreait: <?php echo $portreait; ?>,
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
avideoResponse(response);
if (response && !response.error) {
if(closeWindowAfterImageSave){
avideoModalIframeClose();
}
}
}
});
}
$(document).ready(function () {
<?php
echo $croppie1['createCroppie']."('{$image}');";
?>
});
</script>