1
0
Fork 0
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:
Daniel Neto 2025-05-31 11:05:01 -03:00
parent 117c5e50de
commit 098b0d4640
4 changed files with 160 additions and 134 deletions

View file

@ -1,130 +1,133 @@
<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>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
<div class="panel-body">
<form id="updateConfigForm">
<div class="row">
<div class="col-md-6">
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45">
</div>
</div>
</div>
<div class="col-md-6">
<label class="col-md-4 control-label">
<?php echo __("Your Logo"); ?> (250x70)
</label>
<div class="col-md-8 ">
<div id="croppieLogo"></div>
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
</div>
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-block btn-primary btn-lg"><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</div>
</div>
</form>
</div>
</div>
<script>
var logoCrop;
var logoSmallCrop;
var theme;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
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");
}
}
var logoImgBase64;
$(document).ready(function() {
// start croppie logo
$('#logo').on('change', function() {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function(ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function(ev) {
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,
mouseWheelZoom: false,
viewport: {
width: 250,
height: 70
},
boundary: {
width: 250,
height: 70
}
});
setTimeout(function() {
logoCrop.croppie('setZoom', 1);
}, 1000);
$('#updateConfigForm').submit(function(evt) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
setTimeout(function() {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
logoImgBase64 = resp;
$.ajax({
url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function(response) {
if (response.status === "1") {
avideoAlertSuccess( __("Your configurations has been updated!"));
} else {
avideoAlertError(__("Your configurations has NOT been updated!"));
}
modal.hidePleaseWait();
}
});
});
}, 500);
});
});
</script>
<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>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
<div class="panel-body">
<?php
include $global['systemRootPath'] . 'view/ImageMagick.check.php';
?>
<form id="updateConfigForm">
<div class="row">
<div class="col-md-6">
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" maxlength="45">
</div>
</div>
</div>
<div class="col-md-6">
<label class="col-md-4 control-label">
<?php echo __("Your Logo"); ?> (250x70)
</label>
<div class="col-md-8 ">
<div id="croppieLogo"></div>
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
</div>
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-block btn-primary btn-lg"><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</div>
</div>
</form>
</div>
</div>
<script>
var logoCrop;
var logoSmallCrop;
var theme;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
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");
}
}
var logoImgBase64;
$(document).ready(function() {
// start croppie logo
$('#logo').on('change', function() {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function(ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function(ev) {
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,
mouseWheelZoom: false,
viewport: {
width: 250,
height: 70
},
boundary: {
width: 250,
height: 70
}
});
setTimeout(function() {
logoCrop.croppie('setZoom', 1);
}, 1000);
$('#updateConfigForm').submit(function(evt) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
setTimeout(function() {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function(resp) {
logoImgBase64 = resp;
$.ajax({
url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function(response) {
if (response.status === "1") {
avideoAlertSuccess(__("Your configurations has been updated!"));
} else {
avideoAlertError(__("Your configurations has NOT been updated!"));
}
modal.hidePleaseWait();
}
});
});
}, 500);
});
});
</script>

View file

@ -38,10 +38,11 @@ $linuxApps[] = ['unzip'];
$linuxApps[] = ['youtube-dl'];
$linuxApps[] = ['sshpass', 'https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin#the-process-with-rsync-support-hls'];
$linuxApps[] = ['apache2'];
$linuxApps[] = ['convert', 'sudo apt update && sudo apt install imagemagick'];
$messages = ['Server' => [], 'PHP' => [], 'Apache' => []];
$version = phpversion();
$phpMinVersion = '7.3.0';
$phpMinVersion = '8.0.0';
if (strnatcmp($version, $phpMinVersion) >= 0) {
$messages['PHP'][] = "PHP v{$version}";
} else {
@ -343,4 +344,4 @@ function printMessages($messages, $cols = array(4, 6))
</div>
</div>
</div>
</div>
</div>

View 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">&times;</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
}
?>

View file

@ -292,7 +292,9 @@ if (User::isAdmin()) {
<h2><?php echo __("Logo and Title"); ?></h2>
</div>
<div class="panel-body">
<?php
include $global['systemRootPath'] . 'view/ImageMagick.check.php';
?>
<div class="form-group">
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
<div class="col-md-8 inputGroupContainer">
@ -801,4 +803,4 @@ if (User::isAdmin()) {
</script>
<?php
}
?>
?>