( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$characters = json_decode($characters,true);
$designWidth= $characters['canvasWidth'];
$designHeight= $characters['canvasHeight'];
$characters = $characters['canvas']['objects'];
$content = getConversationRecord($tweetID,$type);
$text = explode("||", $content);
$i = -1;
foreach ($characters as $row) {
$check = $row['type'] ;
if($check=="i-text")
{
$i++;
if($i == 0)
{
$textWrite = $text[0];
}
elseif($i == 1)
{
$textWrite = $text[1];
}
else
{
$textWrite = $row['text'];
}
//echo $i. "$i------<br>";
$fontJson .= '{"family": "'.$row['activeFont']['family'].'" , "category": "'.$row['activeFont']['category'].'" , "type": "'.$row['activeFont']['type'].'" },';
$json .=' {
"type": "i-text",
"version": "3.6.6",
"originX": "left",
"originY": "top",
"left": '.$row['left'].',
"top": '.$row['top'].',
"width": '.$row['width'].',
"height": '.$row['height'].',
"fill": "'.$row['fill'].'",
"stroke": "#000",
"strokeWidth": 0.1,
"strokeDashArray": null,
"strokeLineCap": "butt",
"strokeDashOffset": 0,
"strokeLineJoin": "miter",
"strokeMiterLimit": 4,
"scaleX": 1,
"scaleY": 1,
"angle": 0,
"flipX": false,
"flipY": false,
"opacity": 1,
"shadow": null,
"visible": true,
"clipTo": null,
"backgroundColor": null,
"fillRule": "nonzero",
"paintFirst": "fill",
"globalCompositeOperation": "source-over",
"transformMatrix": null,
"skewX": 0,
"skewY": 0,
"selectable": true,
"evented": true,
"lockMovementX": true,
"lockMovementY": true,
"lockRotation": false,
"lockScalingX": false,
"lockScalingY": false,
"lockUniScaling": false,
"hasControls": true,
"hasBorders": true,
"hasRotatingPoint": true,
"name": "text",
"data": {
"id": "'.$row['data']['id'].'"
},
"activeFont": {
"family": "'.$row['activeFont']['family'].'",
"category": "'.$row['activeFont']['category'].'",
"type": "'.$row['activeFont']['type'].'"
},
"text": "'.$textWrite.'",
"fontSize": '.$row['fontSize'].',
"fontWeight": '.$row['fontWeight'].',
"fontFamily": "'.$row['fontFamily'].'",
"fontStyle": "normal",
"lineHeight":1.1,
"underline": false,
"overline": false,
"linethrough": false,
"textAlign": "initial",
"textBackgroundColor": "",
"charSpacing": 0,
"styles": {}
},';
}
if($check=="image")
{
// exit( $ratio);
$json .= '{
"type": "image",
"version": "3.6.6",
"originX": "center",
"originY": "center",
"left": '.$row['left'].',
"top": '.$row['top'].',
"width": '.$row['width'].',
"height": '.$row['height'].',
"fill": "rgb(30, 139, 195)",
"stroke": "#000",
"strokeWidth": 0,
"strokeDashArray": null,
"strokeLineCap": "butt",
"strokeDashOffset": 0,
"strokeLineJoin": "miter",
"strokeMiterLimit": 4,
"scaleX":'.$row['scaleX'].',
"scaleY": '.$row['scaleY'].',
"angle": '.$row['angle'].',
"flipX": false,
"flipY": false,
"opacity": 1,
"shadow": null,
"visible": true,
"clipTo": null,
"backgroundColor": null,
"fillRule": "nonzero",
"paintFirst": "fill",
"globalCompositeOperation": "source-over",
"transformMatrix": null,
"skewX": 0,
"skewY": 0,
"crossOrigin": "anonymous",
"cropX": 0,
"cropY": 0,
"selectable": true,
"evented": true,
"lockMovementX": true,
"lockMovementY": true,
"lockRotation": false,
"lockScalingX": true,
"lockScalingY": true,
"lockUniScaling": false,
"hasControls": true,
"hasBorders": true,
"hasRotatingPoint": true,
"name": "image",
"data": {
"id": "'.$row['data']['id'].'"
},
"src": "'.$row['src'].'",
"filters": []
},';
}
//include("redesignArray.php");
}
$fontJson = "[".rtrim($fontJson, ',')."]";;
$json = "[".rtrim($json, ',')."]";
$characters = json_decode($json,true);
$charactersFonts = json_decode($fontJson,true);
$this->response["canvas"] = array();
$this->response["canvas"]["version"] = "3.6.6";
$this->response["canvas"]["objects"] = $characters;
$this->response["editor"]["fonts"] = $charactersFonts;
$this->response["canvasWidth"] = $designWidth;
$this->response["canvasHeight"] = $designHeight;
$theJson = json_encode($this->response);;
?>