( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?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);
// $fontsNew .= $db->checkFontNewX($fontFamily);
$fontsNew .= $db->checkFontNewGoogle($fontFamily);
$cssStyle .= $db->checkStyleNew($fontFamily);
}
}
}
if (!empty($_GET['repair'])) {
$themeid = "jsonRepair$themeid";
$initialThemeID = $themeid;
} else {
$themeid = "webjson$themeid";
$initialThemeID = $themeid;
}
?>
<style>
<?php /*echo $cssStyle;*/ ?>
</style>
<div id="dialog-background" style="display: none">
<div id="dialog-loading-wrapper">
<div id="dialog-loading-icon">
</div>
</div>
</div>
<div id="editor-container"></div>
<script src="<?php echo $siteaddress; ?>editorMe2/dist/brand.js"></script>
<script>
const pixie = new Pixie({
crossOrigin: true,
selector: "#editor-container",
baseUrl: '../../editorMe/assets',
<?php
if (empty($_GET['repairJson'])) {?>
state: "<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json",
<?php }
else {?>
state: "<?php echo $siteaddress; ?>TheBrandX/mode.php?mode=repairCanvas&themeid=6253",
<?php }
?>
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
},
activeTheme: 'light',
ui: {
//defaultTool: 'crop',
// showExportPanel: true,
menubar: {
items: [
{
type: 'button',
icon: "../../editorMe2/assets/images/text.png",
action: function () {
pixie.tools.text.add('my text');
}
},
{
type: 'button',
icon: "../../editorMe2/assets/images/dark.png",
align: 'center',
action: function () {
pixie.setConfig({ui: {activeTheme: 'dark'}});
}
},
{
type: 'button',
icon: "../../editorMe2/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"});
pixie.setStateFromUrl("<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json").then(function() {
//state has been loaded
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
});
}
},
{
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: 'display',
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"
}
}, {
family: "Aleo Bold",
src: "fonts/aleo-v4-latin-ext_latin-700.woff2",
descriptors: {
weight: "700"
}
}, {
family: "Amatic SC",
src: "fonts/amatic-sc-v16-latin-ext_latin-regular.woff2"
}, {
family: "Corinthia Bold",
src: "fonts/corinthia-v7-latin-ext_latin-700.woff2"
}, {
family: "Bungee Inline",
src: "fonts/bungee-inline-v6-latin-ext_latin-regular.woff2"
}, {
family: "Robot Slab Bold",
src: "fonts/roboto-slab-v16-latin-ext_latin-500.woff2"
}, {
family: "Carter One",
src: "fonts/carter-one-v12-latin-regular.woff2"
}, {
family: "Cody Star",
src: "fonts/codystar-v10-latin-ext_latin-regular.woff2"
}, {
family: "Fira Sans",
src: "fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"
}, {
family: "Krona One",
src: "fonts/krona-one-v9-latin-ext_latin-regular.woff2"
}, {
family: "Kumar One Outline",
src: "fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2"
}, {
family: "Lobster Two",
src: "fonts/lobster-two-v13-latin-regular.woff2"
}, {
family: "Molle Italic",
src: "fonts/molle-v11-latin-ext_latin-italic.woff2"
}, {
family: "Monoton",
src: "fonts/monoton-v10-latin-regular.woff2"
}, {
family: "Nixie One",
src: "fonts/nixie-one-v11-latin-regular.woff2"
}, {
family: "Permanent Marker",
src: "fonts/permanent-marker-v10-latin-regular.woff2"
}, {
family: "Sancreek",
src: "fonts/sancreek-v13-latin-ext_latin-regular.woff2"
}, {
family: "Stint Ultra Expanded",
src: "fonts/stint-ultra-expanded-v10-latin-regular.woff2"
}, {
family: "VT323",
src: "fonts/vt323-v12-latin-ext_latin-regular.woff2"
}, {
family: "Trash Hand",
src: "fonts/TrashHand.ttf"
}*/
]
}
},
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.setStateFromUrl("<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json").then(function() {
//state has been loaded
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
});
//pixie.resetEditor({state: "<?php echo $siteaddress; ?>easyEdit/<?php echo $themeid; ?>.json"});
//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>