mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Add ImageMagick check and update PHP minimum version to 8.0.0
This commit is contained in:
parent
117c5e50de
commit
098b0d4640
4 changed files with 160 additions and 134 deletions
|
@ -1,130 +1,133 @@
|
||||||
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css" />
|
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css" />
|
||||||
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
|
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
|
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form id="updateConfigForm">
|
<?php
|
||||||
<div class="row">
|
include $global['systemRootPath'] . 'view/ImageMagick.check.php';
|
||||||
<div class="col-md-6">
|
?>
|
||||||
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
|
<form id="updateConfigForm">
|
||||||
<div class="col-md-8 inputGroupContainer">
|
<div class="row">
|
||||||
<div class="input-group">
|
<div class="col-md-6">
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
|
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
|
||||||
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45">
|
<div class="col-md-8 inputGroupContainer">
|
||||||
</div>
|
<div class="input-group">
|
||||||
</div>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
|
||||||
</div>
|
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45">
|
||||||
<div class="col-md-6">
|
</div>
|
||||||
<label class="col-md-4 control-label">
|
</div>
|
||||||
<?php echo __("Your Logo"); ?> (250x70)
|
</div>
|
||||||
</label>
|
<div class="col-md-6">
|
||||||
<div class="col-md-8 ">
|
<label class="col-md-4 control-label">
|
||||||
<div id="croppieLogo"></div>
|
<?php echo __("Your Logo"); ?> (250x70)
|
||||||
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
|
</label>
|
||||||
</div>
|
<div class="col-md-8 ">
|
||||||
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
|
<div id="croppieLogo"></div>
|
||||||
</div>
|
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-md-12">
|
</div>
|
||||||
<button type="submit" class="btn btn-block btn-primary btn-lg"><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
|
<hr>
|
||||||
</div>
|
<div class="row">
|
||||||
</div>
|
<div class="col-md-12">
|
||||||
</form>
|
<button type="submit" class="btn btn-block btn-primary btn-lg"><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
</form>
|
||||||
var logoCrop;
|
</div>
|
||||||
var logoSmallCrop;
|
</div>
|
||||||
var theme;
|
<script>
|
||||||
|
var logoCrop;
|
||||||
function readFile(input, c) {
|
var logoSmallCrop;
|
||||||
console.log("read file");
|
var theme;
|
||||||
if ($(input)[0].files && $(input)[0].files[0]) {
|
|
||||||
var reader = new FileReader();
|
function readFile(input, c) {
|
||||||
reader.onload = function(e) {
|
console.log("read file");
|
||||||
c.croppie('bind', {
|
if ($(input)[0].files && $(input)[0].files[0]) {
|
||||||
url: e.target.result
|
var reader = new FileReader();
|
||||||
}).then(function() {
|
reader.onload = function(e) {
|
||||||
console.log('jQuery bind complete');
|
c.croppie('bind', {
|
||||||
});
|
url: e.target.result
|
||||||
|
}).then(function() {
|
||||||
}
|
console.log('jQuery bind complete');
|
||||||
|
});
|
||||||
reader.readAsDataURL($(input)[0].files[0]);
|
|
||||||
} else {
|
}
|
||||||
avideoAlert("Sorry - you're browser doesn't support the FileReader API");
|
|
||||||
}
|
reader.readAsDataURL($(input)[0].files[0]);
|
||||||
}
|
} else {
|
||||||
|
avideoAlert("Sorry - you're browser doesn't support the FileReader API");
|
||||||
var logoImgBase64;
|
}
|
||||||
|
}
|
||||||
$(document).ready(function() {
|
|
||||||
// start croppie logo
|
var logoImgBase64;
|
||||||
$('#logo').on('change', function() {
|
|
||||||
readFile(this, logoCrop);
|
$(document).ready(function() {
|
||||||
});
|
// start croppie logo
|
||||||
$('#logo-btn').on('click', function(ev) {
|
$('#logo').on('change', function() {
|
||||||
$('#logo').trigger("click");
|
readFile(this, logoCrop);
|
||||||
});
|
});
|
||||||
$('#logo-result-btn').on('click', function(ev) {
|
$('#logo-btn').on('click', function(ev) {
|
||||||
logoCrop.croppie('result', {
|
$('#logo').trigger("click");
|
||||||
type: 'canvas',
|
});
|
||||||
size: 'viewport'
|
$('#logo-result-btn').on('click', function(ev) {
|
||||||
}).then(function(resp) {
|
logoCrop.croppie('result', {
|
||||||
|
type: 'canvas',
|
||||||
});
|
size: 'viewport'
|
||||||
});
|
}).then(function(resp) {
|
||||||
|
|
||||||
logoCrop = $('#croppieLogo').croppie({
|
});
|
||||||
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?' + Math.random(),
|
});
|
||||||
enableExif: true,
|
|
||||||
enforceBoundary: false,
|
logoCrop = $('#croppieLogo').croppie({
|
||||||
mouseWheelZoom: false,
|
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?' + Math.random(),
|
||||||
viewport: {
|
enableExif: true,
|
||||||
width: 250,
|
enforceBoundary: false,
|
||||||
height: 70
|
mouseWheelZoom: false,
|
||||||
},
|
viewport: {
|
||||||
boundary: {
|
width: 250,
|
||||||
width: 250,
|
height: 70
|
||||||
height: 70
|
},
|
||||||
}
|
boundary: {
|
||||||
});
|
width: 250,
|
||||||
setTimeout(function() {
|
height: 70
|
||||||
logoCrop.croppie('setZoom', 1);
|
}
|
||||||
}, 1000);
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
logoCrop.croppie('setZoom', 1);
|
||||||
$('#updateConfigForm').submit(function(evt) {
|
}, 1000);
|
||||||
evt.preventDefault();
|
|
||||||
modal.showPleaseWait();
|
|
||||||
$('#tabRegularLink').tab('show');
|
$('#updateConfigForm').submit(function(evt) {
|
||||||
setTimeout(function() {
|
evt.preventDefault();
|
||||||
logoCrop.croppie('result', {
|
modal.showPleaseWait();
|
||||||
type: 'canvas',
|
$('#tabRegularLink').tab('show');
|
||||||
size: 'viewport'
|
setTimeout(function() {
|
||||||
}).then(function(resp) {
|
logoCrop.croppie('result', {
|
||||||
logoImgBase64 = resp;
|
type: 'canvas',
|
||||||
$.ajax({
|
size: 'viewport'
|
||||||
url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php',
|
}).then(function(resp) {
|
||||||
data: {
|
logoImgBase64 = resp;
|
||||||
"logoImgBase64": logoImgBase64,
|
$.ajax({
|
||||||
"webSiteTitle": $('#inputWebSiteTitle').val(),
|
url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php',
|
||||||
},
|
data: {
|
||||||
type: 'post',
|
"logoImgBase64": logoImgBase64,
|
||||||
success: function(response) {
|
"webSiteTitle": $('#inputWebSiteTitle').val(),
|
||||||
if (response.status === "1") {
|
},
|
||||||
avideoAlertSuccess( __("Your configurations has been updated!"));
|
type: 'post',
|
||||||
} else {
|
success: function(response) {
|
||||||
avideoAlertError(__("Your configurations has NOT been updated!"));
|
if (response.status === "1") {
|
||||||
}
|
avideoAlertSuccess(__("Your configurations has been updated!"));
|
||||||
modal.hidePleaseWait();
|
} else {
|
||||||
}
|
avideoAlertError(__("Your configurations has NOT been updated!"));
|
||||||
});
|
}
|
||||||
});
|
modal.hidePleaseWait();
|
||||||
}, 500);
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}, 500);
|
||||||
</script>
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -38,10 +38,11 @@ $linuxApps[] = ['unzip'];
|
||||||
$linuxApps[] = ['youtube-dl'];
|
$linuxApps[] = ['youtube-dl'];
|
||||||
$linuxApps[] = ['sshpass', 'https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin#the-process-with-rsync-support-hls'];
|
$linuxApps[] = ['sshpass', 'https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin#the-process-with-rsync-support-hls'];
|
||||||
$linuxApps[] = ['apache2'];
|
$linuxApps[] = ['apache2'];
|
||||||
|
$linuxApps[] = ['convert', 'sudo apt update && sudo apt install imagemagick'];
|
||||||
|
|
||||||
$messages = ['Server' => [], 'PHP' => [], 'Apache' => []];
|
$messages = ['Server' => [], 'PHP' => [], 'Apache' => []];
|
||||||
$version = phpversion();
|
$version = phpversion();
|
||||||
$phpMinVersion = '7.3.0';
|
$phpMinVersion = '8.0.0';
|
||||||
if (strnatcmp($version, $phpMinVersion) >= 0) {
|
if (strnatcmp($version, $phpMinVersion) >= 0) {
|
||||||
$messages['PHP'][] = "PHP v{$version}";
|
$messages['PHP'][] = "PHP v{$version}";
|
||||||
} else {
|
} else {
|
||||||
|
@ -343,4 +344,4 @@ function printMessages($messages, $cols = array(4, 6))
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
20
view/ImageMagick.check.php
Normal file
20
view/ImageMagick.check.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
$convertPath = trim(shell_exec('which convert'));
|
||||||
|
|
||||||
|
if (empty($convertPath)) {
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<strong><?php echo __("ImageMagick not installed."); ?></strong>
|
||||||
|
<p><?php echo __("Please install it with:"); ?></p>
|
||||||
|
<pre><code>sudo apt update && sudo apt install imagemagick</code></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
|
@ -292,7 +292,9 @@ if (User::isAdmin()) {
|
||||||
<h2><?php echo __("Logo and Title"); ?></h2>
|
<h2><?php echo __("Logo and Title"); ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<?php
|
||||||
|
include $global['systemRootPath'] . 'view/ImageMagick.check.php';
|
||||||
|
?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
|
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
|
||||||
<div class="col-md-8 inputGroupContainer">
|
<div class="col-md-8 inputGroupContainer">
|
||||||
|
@ -801,4 +803,4 @@ if (User::isAdmin()) {
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue