( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include("../includes/limittext.php");
include('../Connections/videoondemand.php');
require("../DbSql2.inc.php");
require("../NewsSql2.inc.php");
$db = new NewsSQL;
include("../protect.php");
ini_set('display_errors', 0);
session_start();
$userid = $_COOKIE['euserid'];
if (empty ($userid)) {
header("Location: $siteaddress2/");
}
if (empty($_GET['themeid'])) {
header("Location: $siteaddress2/");
exit();
} else {
$themeid = $_GET['themeid'];
$themeid = $db->base64url_decode($themeid);
$url = $db->getEachLayerJson($themeid,1);
$url = str_replace("http://localhost/thebrand/","https://www.thebrand.ai/",$url) ;
$urlArray = str_replace("'","",$url);
$Description = json_decode($urlArray , true);
$brandLayers = $Description['canvas']['objects'];
$brandWidth = $Description['canvasWidth'];
$brandHeight = $Description['canvasHeight'];
foreach ($brandLayers as $value) {
$imageCount++;
$type = $value['type'];
if($type=="i-text") {
$fontFamily = $value['fontFamily'];
$fontsNew .= $db->checkFontNew($fontFamily);
// $cssStyle .= $db->checkStyleNew($fontFamily);
}
}
}
if (!empty($_GET['repair'])) {
$themeid = "jsonRepair$themeid";
} else {
$themeid = "webjson$themeid";
}
?>
<style>
<?php /*echo $cssStyle;*/?>
</style>
<div id="dialog-background">
<div id="dialog-loading-wrapper">
<div id="dialog-loading-icon">
</div>
</div>overl
</div>
<div id="editor-container"></div>
<script src="<?php echo $siteaddress; ?>editorMe/dist/pixie.umd.js"></script>
<script>
const pixie = new Pixie({
crossOrigin: true,
selector: "#editor-container",
baseUrl: '../../editorMe/assets',
//image: "assets/images/samples/sample1.jpg",
state: "<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json",
objectDefaults: {
transparentCorners: false,
borderOpacityWhenMoving: 1,
cornerStyle: 'circle', //rect or circle
cornerColor: '#101994',
cornerStrokeColor: '#f31419',
cornerSize: 16,
strokeWidth: 0.05,
lockUniScaling: true, //preserver aspect ratio when resizing via handle
},
ui: {
openImageDialog: {
show: true
},
activeTheme: 'light',
nav: {
position: 'top',
replaceDefault: false,
items: [
{
type: 'button',
icon: "../../editorMe/assets/images/layers.png",
align: 'right',
action: function () {
console.log(pixie.tools.objects.getAll());
pixie.togglePanel('objects');
}
},
{
type: "button",
label: 'Save',
icon: "../../editorMe/assets/images/upload2.png",
text: "Add",
action: function () {
//console.log('custom action!');
pixie.tools.import.uploadAndAddImage().then(function (obj) {
});
//pixie.tools.filter.apply(filterTool.getByName('grayscale'));
},
},
],
},
menubar: {
items: [
{
type: 'button',
icon: "../../editorMe/assets/images/text.png",
action: function () {
pixie.tools.text.add('my text');
}
},
{
type: 'button',
icon: "../../editorMe/assets/images/dark.png",
align: 'center',
action: function () {
pixie.setConfig({ui: {activeTheme: 'dark'}});
}
},
{
type: 'button',
icon: "../../editorMe/assets/images/light.png",
align: 'center',
action: function () {
pixie.setConfig({ui: {activeTheme: 'light'}});
}
},
{
type: 'button',
icon: "../../editorMe/assets/images/download.png",
align: 'right',
label: 'Download',
action: function () {
//console.log('custom action!');
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'block';
spinner.style.visibility = 'visible';
pixie.tools.export.save2('The Brand Image <?php echo rand(100,222)?>', 'png', 0.8);
//pixie.tools.filter.apply(filterTool.getByName('grayscale'));
pixie.resetEditor({state: "<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json"});
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
//console.log(data);
}
},
{
type: 'button',
icon: [
{
tag: 'path',
attr: {
d: 'm11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z',
},
},
],
align: 'right',
position: 0,
action: editor => {
editor.togglePanel('objects');
},
},
{
type: 'button',
icon: [
{
tag: 'path',
attr: {
d: 'M18 20H4V6h9V4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2v9zm-7.79-3.17-1.96-2.36L5.5 18h11l-3.54-4.71zM20 4V1h-2v3h-3c.01.01 0 2 0 2h3v2.99c.01.01 2 0 2 0V6h3V4h-3z',
},
},
],
align: 'left',
buttonVariant: 'outline',
menuItems: [
{
action: editor => {
editor.tools.import.uploadAndAddImage();
},
label: 'Overlay Image',
},
],
},
],
},
},
tools: {
export: {
defaultFormat: 'png', //png, jpeg or json
defaultName: 'image', //default name for downloaded photo file
defaultQuality: 1, //works with jpeg only, 0 to 1
},
text: {
replaceDefault: false,
defaultCategory: 'handwriting',
items: [
<?php echo $fontsNew;?> {
family: 'Roboto',
src: 'fonts/open-sans-v27-latin-ext_latin-regular.woff2',
},
{
family: 'Fuzzy Bubbles',
src: 'fonts/fuzzy-bubbles-v3-latin-700.woff2',
descriptors: {weight: '700'},
}
]
}
},
onSave: async function (data) {
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'block';
spinner.style.visibility = 'visible';
const state = pixie.getState();
<?php $themeidX =str_replace("webjson","","$themeid");
?>
const response = await fetch('<?php echo $siteaddress; ?>TheBrandX/mode.php?mode=saveDesignNewInterface&themeid=<?php echo $themeidX; ?>&nani=<?php echo $userid; ?>', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: state,
data: state
});
//console.log(state);
//console.log(state);
pixie.resetEditor({state: "<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json"});
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
//console.log(data);
},
onLoad: function () {
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
// pixie.togglePanel('objects');
pixie.tools.frame.add('grunge');
//can be called at any time to change editor theme
pixie.setConfig({ui: {activeTheme: 'light'}});
function dark() {
pixie.setConfig({ui: {activeTheme: 'dark'}});
}
// document.addEventListener("click", this.dark.bind(this));
document.querySelector('.light-button').addEventListener('click', function (e) {
pixie.setConfig({ui: {activeTheme: 'light'}});
});
pixie.setConfig({ui: {activeTheme: 'light'}});
//pixie.setConfig({ui: {mode: 'overlay'}});
/* document.querySelector('.open-button').addEventListener('click', function(e) {
pixie.resetAndOpenEditor({image: 'http://localhost/thebrand/taswira.php?width=700&quality=70&image=/v/uploads/gallery/9b430f8576d05120019e18f999bde35a.jpg'});
});*/
/* var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'block';
spinner.style.visibility = 'visible';*/
}
});
window.pixie = pixie;
</script>