mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed problems with upload images and show images in created visual consoles. Gitlab: #314
This commit is contained in:
parent
3ffe8ae49f
commit
ca8ec686ac
@ -95,12 +95,26 @@ if (defined('METACONSOLE')) {
|
|||||||
$table->align[1] = 'left';
|
$table->align[1] = 'left';
|
||||||
}
|
}
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
|
$table->size[0] = '20%';
|
||||||
|
$table->size[1] = '20%';
|
||||||
|
$table->size[1] = '50%';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$table->data[0][0] = __('Name:') .
|
$table->data[0][0] = __('Name:') .
|
||||||
ui_print_help_tip(__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true);
|
ui_print_help_tip(__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true);
|
||||||
|
|
||||||
$table->data[0][1] = html_print_input_text('name', $visualConsoleName,
|
$table->data[0][1] = html_print_input_text('name', $visualConsoleName,
|
||||||
'', 80, 100, true);
|
'', 80, 100, true);
|
||||||
|
|
||||||
|
$table->rowspan[0][2] = 6;
|
||||||
|
if ($action == 'new') {
|
||||||
|
$table->data[0][2] = '<img id="imagen" style="display:none;"
|
||||||
|
src="">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$table->data[0][2] = '<img id="imagen" style="width:230px;"
|
||||||
|
src="images/console/background/'.$background.'">';
|
||||||
|
}
|
||||||
|
|
||||||
$table->data[1][0] = __('Group:');
|
$table->data[1][0] = __('Group:');
|
||||||
$groups = users_get_groups ($config['id_user'], 'RW');
|
$groups = users_get_groups ($config['id_user'], 'RW');
|
||||||
|
|
||||||
@ -150,16 +164,6 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
|
|||||||
value="modsize">' . __('Set default size') .
|
value="modsize">' . __('Set default size') .
|
||||||
'</button></span>';
|
'</button></span>';
|
||||||
|
|
||||||
if ($action == 'new') {
|
|
||||||
$table->data[5][2] = '<img id="imagen" style="display:none"
|
|
||||||
src="">';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$table->data[5][2] = '<img id="imagen" style="display:none"
|
|
||||||
src="images/console/background/'.$background.'">';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[0][3] = $table->data[0][4] = $table->data[0][5] = '';
|
|
||||||
if ($action == 'new') {
|
if ($action == 'new') {
|
||||||
$textButtonSubmit = __('Save');
|
$textButtonSubmit = __('Save');
|
||||||
$classButtonSubmit = 'sub wand';
|
$classButtonSubmit = 'sub wand';
|
||||||
@ -185,46 +189,60 @@ echo "</form>";
|
|||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
$("#modsize").click(function(event){
|
$("#modsize").click(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if($('.opt').css('visibility') == 'hidden'){
|
if($('.opt').css('visibility') == 'hidden'){
|
||||||
$('.opt').css('visibility','visible');
|
$('.opt').css('visibility','visible');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('#imagen').attr('src') != '') {
|
||||||
|
$('input[name=width]').val($('#imagen').width());
|
||||||
|
$('input[name=height]').val($('#imagen').height());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#getsize").click(function(event){
|
||||||
|
event.preventDefault();
|
||||||
$('input[name=width]').val($('#imagen').width());
|
$('input[name=width]').val($('#imagen').width());
|
||||||
$('input[name=height]').val($('#imagen').height());
|
$('input[name=height]').val($('#imagen').height());
|
||||||
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$("#getsize").click(function(event){
|
$("#background").change(function() {
|
||||||
event.preventDefault();
|
$('#imagen').attr('src','images/console/background/'+$('#background').val());
|
||||||
|
$('#imagen').width(230);
|
||||||
|
$('#imagen').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$( "input[type=submit]" ).click(function( event ) {
|
||||||
|
if($( "#getsize" ).css('visibility')=='hidden'){
|
||||||
|
$('input[name=width]').val($('#imagen').width());
|
||||||
|
$('input[name=height]').val($('#imagen').height());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#file-background_image").change(function(){
|
||||||
|
readURL(this);
|
||||||
|
});
|
||||||
|
|
||||||
$('input[name=width]').val($('#imagen').width());
|
function readURL(input) {
|
||||||
$('input[name=height]').val($('#imagen').height());
|
if (input.files && input.files[0]) {
|
||||||
|
var reader = new FileReader();
|
||||||
});
|
reader.onload = function (e) {
|
||||||
|
$('#imagen').attr('src', e.target.result);
|
||||||
$("#background").click(function(event){
|
$('#imagen').width(230);
|
||||||
$('#imagen').attr('src','images/console/background/'+$('#background').val());
|
$('#imagen').show();
|
||||||
});
|
}
|
||||||
|
reader.readAsDataURL(input.files[0]);
|
||||||
$( "input[type=submit]" ).click(function( event ) {
|
}
|
||||||
|
|
||||||
if($( "#getsize" ).css('visibility')=='hidden'){
|
|
||||||
$('input[name=width]').val($('#imagen').width());
|
|
||||||
$('input[name=height]').val($('#imagen').height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
$("#imgInp").change(function(){
|
||||||
$("#file-background_image").change(function(event){
|
readURL(this);
|
||||||
$('#back').submit();
|
});
|
||||||
});
|
|
||||||
|
$("#text-background_color").attachColorPicker();
|
||||||
$("#text-background_color").attachColorPicker();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ switch ($activeTab) {
|
|||||||
|
|
||||||
if ($uploadOK == 1) {
|
if ($uploadOK == 1) {
|
||||||
if (move_uploaded_file($_FILES["background_image"]["tmp_name"], $target_file)) {
|
if (move_uploaded_file($_FILES["background_image"]["tmp_name"], $target_file)) {
|
||||||
$background = $_FILES["background_image"]["name"];
|
$background = $nameImage;
|
||||||
$values['background'] = $background;
|
$values['background'] = $background;
|
||||||
$error2 = chmod($target_file, 0644);
|
$error2 = chmod($target_file, 0644);
|
||||||
$uploadOK = $error2;
|
$uploadOK = $error2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user