Assets/Render and Users/Render dep
This commit is contained in:
parent
7e244634ae
commit
cbc4041f49
|
|
@ -5,48 +5,51 @@
|
|||
kinda shit but its meant for background render processes so not really a concern
|
||||
*/
|
||||
|
||||
use Alphaland\Assets\Render as AssetRender;
|
||||
use Alphaland\Users\Render as UserRender;
|
||||
|
||||
$assetid = $argv[1];
|
||||
$type = $argv[2];
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case "avatar":
|
||||
RenderPlayer($assetid);
|
||||
UserRender::RenderPlayer($assetid);
|
||||
break;
|
||||
case "avatarcloseup":
|
||||
RenderPlayerCloseup($assetid);
|
||||
UserRender::RenderPlayerCloseup($assetid);
|
||||
break;
|
||||
case "hat":
|
||||
RenderHat($assetid);
|
||||
AssetRender::RenderHat($assetid);
|
||||
break;
|
||||
case "tshirt":
|
||||
RenderTShirt($assetid);
|
||||
AssetRender::RenderTShirt($assetid);
|
||||
break;
|
||||
case "shirt":
|
||||
RenderShirt($assetid);
|
||||
AssetRender::RenderShirt($assetid);
|
||||
break;
|
||||
case "pants":
|
||||
RenderPants($assetid);
|
||||
AssetRender::RenderPants($assetid);
|
||||
break;
|
||||
case "face":
|
||||
RenderFace($assetid);
|
||||
AssetRender::RenderFace($assetid);
|
||||
break;
|
||||
case "gear":
|
||||
RenderGear($assetid);
|
||||
AssetRender::RenderGear($assetid);
|
||||
break;
|
||||
case "head":
|
||||
RenderHead($assetid);
|
||||
AssetRender::RenderHead($assetid);
|
||||
break;
|
||||
case "place":
|
||||
RenderPlace($assetid);
|
||||
break;
|
||||
case "package":
|
||||
RenderPackage($assetid);
|
||||
AssetRender::RenderPackage($assetid);
|
||||
break;
|
||||
case "model":
|
||||
RenderModel($assetid);
|
||||
AssetRender::RenderModel($assetid);
|
||||
case "mesh":
|
||||
RenderMesh($assetid);
|
||||
AssetRender::RenderMesh($assetid);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,374 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
namespace Alphaland\Assets {
|
||||
|
||||
use Alphaland\Common\HashingUtiltity;
|
||||
use Alphaland\Grid\RccServiceHelper;
|
||||
use Alphaland\UI\ImageHelper;
|
||||
use PDO;
|
||||
|
||||
class Render
|
||||
{
|
||||
public static function RenderHat(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." hat", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['hatthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Hat ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Hat ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderTShirt(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." tshirt", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['tshirtthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render TShirt ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render TShirt ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderShirt(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." shirt", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['shirtthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Shirt ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Shirt ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderPants(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." pants", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['pantsthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Pants ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Pants ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderFace(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." face", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['facethumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Face ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Face ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderHead(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." head", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['headthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Head ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Head ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderGear(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." gear", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['gearthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Gear ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"png",
|
||||
"750",
|
||||
"750",
|
||||
"https://www.alphaland.cc/"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Gear ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderPackage(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." package", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['packagescript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Package ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=27112025;https://www.alphaland.cc/asset/?id=27112039;https://www.alphaland.cc/asset/?id=27112052",
|
||||
"https://www.alphaland.cc/",
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Package ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderModel(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." model", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['modelthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Model ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Model ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderMesh(int $assetid, bool $fork=false)
|
||||
{
|
||||
if ($fork) {
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$assetid." mesh", "r"); //throwaway background process
|
||||
if ($job !== FALSE); {
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
$thumbnailScript = file_get_contents($GLOBALS['meshthumbnailscript']);
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Mesh ".$assetid, $thumbnailScript, array(
|
||||
$assetid,
|
||||
"https://www.alphaland.cc/asset/?id=".$assetid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($assetid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Mesh ".$assetid." Job", $thumbnailScript);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function Update(int $assetid, $soapobject)
|
||||
{
|
||||
$render = base64_decode($soapobject->BatchJobExResult->LuaValue[0]->value);
|
||||
|
||||
if (ImageHelper::IsBase64PNGImage($render)) //PNG
|
||||
{
|
||||
$newhash = HashingUtiltity::VerifyMD5(md5($render));
|
||||
if (!file_get_contents($GLOBALS['renderCDNPath'] . $newhash))
|
||||
{
|
||||
if (file_put_contents($GLOBALS['renderCDNPath'] . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $assetid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($GLOBALS['renderCDNPath'] . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $assetid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Alphaland\Common {
|
||||
use PDO;
|
||||
class HashingUtiltity
|
||||
{
|
||||
public static function GenerateByteHash(int $length): string
|
||||
{
|
||||
return bin2hex(openssl_random_pseudo_bytes($length));
|
||||
}
|
||||
|
||||
public static function GenRandomAssetHash(int $len): string
|
||||
{
|
||||
$hash = "";
|
||||
do {
|
||||
$hash = HashingUtiltity::GenerateByteHash($len);
|
||||
$tokencheck = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM assets WHERE Hash = :t");
|
||||
$tokencheck->bindParam(":t", $hash, PDO::PARAM_STR);
|
||||
$tokencheck->execute();
|
||||
} while ($tokencheck->fetchColumn() != 0);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
public static function VerifyMD5(string $md5)
|
||||
{
|
||||
$hashcheck = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM assets WHERE Hash = :t");
|
||||
$hashcheck->bindParam(":t", $md5, PDO::PARAM_STR);
|
||||
$hashcheck->execute();
|
||||
if ($hashcheck->fetchColumn() != 0) {
|
||||
$md5 = HashingUtiltity::GenRandomAssetHash(16); //fallback to random gen hash (this sshouldnt happen often)
|
||||
}
|
||||
return $md5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Alphaland\UI {
|
||||
|
||||
use GdImage;
|
||||
|
||||
class ImageHelper
|
||||
{
|
||||
public static function CopyMergeImageAlpha(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): void
|
||||
{
|
||||
$img = imagecreatetruecolor($src_w, $src_h);
|
||||
imagecopy($img, $dst_image, 0, 0, $dst_x, $dst_y, $src_w, $src_h);
|
||||
imagecopy($img, $src_image, 0, 0, $src_x, $src_y, $src_w, $src_h);
|
||||
imagecopymerge($dst_image, $img, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);
|
||||
}
|
||||
|
||||
public static function IsBase64PNGImage(string $base64): bool
|
||||
{
|
||||
$mime = finfo_buffer(finfo_open(), $base64, FILEINFO_MIME_TYPE);
|
||||
|
||||
if (in_array($mime, array("image/png"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function ResizeImageFromString(int $newWidth, int $newHeight, string $targetFile, string $originalFile): bool
|
||||
{
|
||||
$img = imagecreatefromstring($originalFile);
|
||||
$width = imagesx($img);
|
||||
$height = imagesy($img);
|
||||
$tmp = imagecreatetruecolor($newWidth, $newHeight);
|
||||
imagealphablending($tmp, false);
|
||||
imagesavealpha($tmp, true);
|
||||
imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
if (imagepng($tmp, "$targetFile")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
namespace Alphaland\Users {
|
||||
|
||||
use Alphaland\Common\HashingUtiltity;
|
||||
use Alphaland\Grid\RccServiceHelper;
|
||||
use Alphaland\UI\ImageHelper;
|
||||
use PDO;
|
||||
|
||||
class Render
|
||||
{
|
||||
public static function RenderPlayerCloseup(int $userid, bool $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$userid." avatarcloseup", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = file_get_contents($GLOBALS['avatarcloseupthumbnailscript']);
|
||||
|
||||
$angleright = userInfo($userid)->headshotAngleRight;
|
||||
$angleleft = userInfo($userid)->headshotAngleLeft;
|
||||
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Player Closeup ".$userid, $script, array(
|
||||
$userid,
|
||||
"https://www.alphaland.cc/",
|
||||
"https://api.alphaland.cc/users/avatar-accoutrements?userId=".$userid,
|
||||
"png",
|
||||
"840",
|
||||
"840",
|
||||
(bool)$angleright, //angleRight
|
||||
(bool)$angleleft //angleLeft
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($userid, $soap, true);
|
||||
return true;
|
||||
} else {
|
||||
die(print_r($soap));
|
||||
}
|
||||
logSoapFault($soap, "Render Player Closeup ".$userid." Job", $script);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function RenderPlayer(int $userid, bool $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$userid." avatar", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Render::RenderPlayerCloseup($userid, true); //run in the background so it will *hopefully* finish with this
|
||||
$script = file_get_contents($GLOBALS['avatarthumbnailscript']);
|
||||
|
||||
$soap = new RccServiceHelper($GLOBALS['thumbnailArbiter']);
|
||||
$soap = $soap->BatchJobEx(
|
||||
$soap->ConstructGenericJob(gen_uuid(), 25, 0, 3, "Render Player ".$userid, $script, array(
|
||||
$userid,
|
||||
"https://api.alphaland.cc/users/avatar-accoutrements?userId=".$userid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"840",
|
||||
"840"
|
||||
))
|
||||
);
|
||||
|
||||
if (!is_soap_fault($soap)) {
|
||||
Render::Update($userid, $soap);
|
||||
return true;
|
||||
}
|
||||
logSoapFault($soap, "Render Player ".$userid." Job", $script);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function Update(int $userid, $soapobject, $headshot=false)
|
||||
{
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
$render = base64_decode($soapobject->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
|
||||
if (ImageHelper::IsBase64PNGImage($render)) //PNG
|
||||
{
|
||||
$newhash = HashingUtiltity::VerifyMD5(md5($render));
|
||||
if (ImageHelper::ResizeImageFromString(352 , 352 , $path . $newhash, $render)) //scale down for a SLIGHT AA effect
|
||||
{
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
if ($headshot) {
|
||||
$oldhash = $prevhash->HeadshotThumbHash;
|
||||
if ($oldhash != $newhash && !isHeadshotThumbHashInOutfit($oldhash)) {
|
||||
unlink($path . $oldhash);
|
||||
}
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE users SET HeadshotThumbHash = :h, pendingHeadshotRender = 0, renderCount = renderCount-1 WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
} else {
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
if ($oldhash != $newhash && !isThumbHashInOutfit($oldhash)) {
|
||||
unlink($path . $oldhash);
|
||||
}
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE users SET ThumbHash = :h, pendingRender = 0, renderCount = renderCount-1 WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -107,6 +107,9 @@ try
|
|||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Common/System.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Games/Game.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Grid/RccServiceHelper.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Assets/Render.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/UI/ImageHelper.php";
|
||||
include "C:/Webserver/nginx/Alphaland/globals/Dependencies/Users/Render.php";
|
||||
|
||||
//authenticator
|
||||
$authenticator = new PHPGangsta_GoogleAuthenticator();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
//img tools (potentially high resource usage) (probably blocking)
|
||||
|
||||
use Alphaland\Assets\Render;
|
||||
use Alphaland\Users\Render as UsersRender;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
|
||||
function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) {
|
||||
|
|
@ -230,34 +232,6 @@ function genGameLaunchTokenHash($len)
|
|||
return $hash;
|
||||
}
|
||||
|
||||
function genThumbHash($len)
|
||||
{
|
||||
$hash = "";
|
||||
$alloc = true;
|
||||
while ($alloc) {
|
||||
$hash = genHash($len);
|
||||
|
||||
$usercheck = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE ThumbHash = :t");
|
||||
$usercheck->bindParam(":t", $hash, PDO::PARAM_STR);
|
||||
$usercheck->execute();
|
||||
|
||||
$headshotusercheck = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE HeadshotThumbHash = :t");
|
||||
$headshotusercheck->bindParam(":t", $hash, PDO::PARAM_STR);
|
||||
$headshotusercheck->execute();
|
||||
|
||||
$assetscheck = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE ThumbHash = :t");
|
||||
$assetscheck->bindParam(":t", $hash, PDO::PARAM_STR);
|
||||
$assetscheck->execute();
|
||||
|
||||
if ($usercheck->rowCount() > 0 || $assetscheck->rowCount() > 0 || $headshotusercheck->rowCount() > 0) {
|
||||
continue;
|
||||
} else {
|
||||
$alloc = false;
|
||||
}
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
|
||||
//gen uuid
|
||||
function gen_uuid() {
|
||||
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
|
|
@ -611,7 +585,7 @@ function applyOutfit($userid, $outfitid)
|
|||
|
||||
if ($headshothash == NULL) //outfit was created before headshots release (probably?)
|
||||
{
|
||||
RenderPlayerCloseup($userid);
|
||||
UsersRender::RenderPlayerCloseup($userid);
|
||||
|
||||
$headshothash = userInfo($userid)->HeadshotThumbHash;
|
||||
|
||||
|
|
@ -2206,72 +2180,6 @@ function isJobMarkedClosed($jobid)
|
|||
|
||||
//render utility functions
|
||||
|
||||
function RenderPlayer($userid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$userid." avatar", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPlayerCloseup($userid, true); //run in the background so it will *hopefully* finish with this
|
||||
|
||||
$script = $GLOBALS['avatarthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render player ".$userid, file_get_contents($script), array(
|
||||
$userid,
|
||||
"https://api.alphaland.cc/users/avatar-accoutrements?userId=".$userid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"840",
|
||||
"840",
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (resizebase64img(352 , 352 , $path . $newhash, $render)) //scale down for a SLIGHT AA effect
|
||||
{
|
||||
//delete old render
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
if ($oldhash != $newhash && !isThumbHashInOutfit($oldhash)) //dont delete hash if its part of an outfit
|
||||
{
|
||||
unlink($path . $oldhash);
|
||||
}
|
||||
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE users SET ThumbHash = :h, pendingRender = 0, renderCount = renderCount-1 WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Player ".$userid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setHeadshotAngleRight($userid)
|
||||
{
|
||||
$right = $GLOBALS['pdo']->prepare('UPDATE users SET headshotAngleRight = 1, headshotAngleLeft = 0 WHERE id = :uid');
|
||||
|
|
@ -2308,520 +2216,6 @@ function setHeadshotAngleCenter($userid)
|
|||
return false;
|
||||
}
|
||||
|
||||
function RenderPlayerCloseup($userid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$userid." avatarcloseup", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['avatarcloseupthumbnailscript'];
|
||||
|
||||
$angleright = userInfo($userid)->headshotAngleRight;
|
||||
$angleleft = userInfo($userid)->headshotAngleLeft;
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Player Closeup ".$userid, file_get_contents($script), array(
|
||||
$userid,
|
||||
"https://www.alphaland.cc/",
|
||||
"https://api.alphaland.cc/users/avatar-accoutrements?userId=".$userid,
|
||||
"png",
|
||||
"840",
|
||||
"840",
|
||||
false, //quadratic
|
||||
false, //OnlyCheckHeadAccessoryInHeadShot
|
||||
(bool)$angleright, //angleRight
|
||||
(bool)$angleleft, //angleLeft
|
||||
0, //baseHatZoom
|
||||
90, //maxHatZoom (100 for little farther out)
|
||||
0, //cameraOffsetX
|
||||
-0.1 //cameraOffsetY
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (resizebase64img(352 , 352 , $path . $newhash, $render)) //scale down for a SLIGHT AA effect
|
||||
{
|
||||
//delete old render
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->HeadshotThumbHash;
|
||||
if ($oldhash != $newhash && !isHeadshotThumbHashInOutfit($oldhash)) //dont delete hash if its part of an outfit
|
||||
{
|
||||
unlink($path . $oldhash);
|
||||
}
|
||||
|
||||
//$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE users SET ThumbHash = :h, pendingRender = 0, renderCount = renderCount-1 WHERE id = :i");
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE users SET HeadshotThumbHash = :h, pendingHeadshotRender = 0, renderCount = renderCount-1 WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $userid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Player Closeup ".$userid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderHat($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." hat", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['hatthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Hat ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Hat ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderTShirt($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." tshirt", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['tshirtthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render TShirt ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render TShirt ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderShirt($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." shirt", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['shirtthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Shirt ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Shirt ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderPants($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." pants", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['pantsthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Pants ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Pants ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderFace($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." face", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['facethumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Face ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Face ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderGear($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." gear", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['gearthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Gear ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"png",
|
||||
"750",
|
||||
"750",
|
||||
"https://www.alphaland.cc/"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Gear ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderHead($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." head", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['headthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Head ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"750",
|
||||
"750"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Head ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderPlace($placeid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
|
|
@ -2898,194 +2292,6 @@ function RenderPlace($placeid, $fork=false)
|
|||
}
|
||||
}
|
||||
|
||||
function RenderPackage($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." package", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['packagescript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Package ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=27112025;https://www.alphaland.cc/asset/?id=27112039;https://www.alphaland.cc/asset/?id=27112052",
|
||||
"https://www.alphaland.cc/",
|
||||
"https://www.alphaland.cc/asset/?id=38",
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Package ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderModel($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." model", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['modelthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Model ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Model ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function RenderMesh($itemid, $fork=false)
|
||||
{
|
||||
if ($fork)
|
||||
{
|
||||
$job = popen("cd C:/Webserver/nginx/Alphaland/WebserviceTools/RenderTools && start /B php backgroundRenderJob.php ".$itemid." mesh", "r"); //throwaway background process
|
||||
if ($job !== FALSE);
|
||||
{
|
||||
pclose($job);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = $GLOBALS['meshthumbnailscript'];
|
||||
|
||||
$result = soapBatchJobEx($GLOBALS['thumbnailArbiter'], gen_uuid(), 25, "Render Mesh ".$itemid, file_get_contents($script), array(
|
||||
$itemid,
|
||||
"https://www.alphaland.cc/asset/?id=".$itemid,
|
||||
"https://www.alphaland.cc/",
|
||||
"png",
|
||||
"768",
|
||||
"432"
|
||||
)
|
||||
);
|
||||
|
||||
if (!is_soap_fault($result))
|
||||
{
|
||||
$render = base64_decode($result->BatchJobExResult->LuaValue[0]->value); //returned by rcc
|
||||
$path = $GLOBALS['renderCDNPath'];
|
||||
|
||||
if (isbase64png($render)) //PNG
|
||||
{
|
||||
$newhash = safeAssetMD5(md5($render));
|
||||
if (file_put_contents($path . $newhash, $render))
|
||||
{
|
||||
//delete old hash
|
||||
$prevhash = $GLOBALS['pdo']->prepare("SELECT * FROM assets WHERE id = :i");
|
||||
$prevhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$prevhash->execute();
|
||||
$prevhash = $prevhash->fetch(PDO::FETCH_OBJ);
|
||||
$oldhash = $prevhash->ThumbHash;
|
||||
unlink($path . $oldhash);
|
||||
|
||||
//set new hash
|
||||
$newthumbhash = $GLOBALS['pdo']->prepare("UPDATE assets SET ThumbHash = :h WHERE id = :i");
|
||||
$newthumbhash->bindParam(":h", $newhash, PDO::PARAM_STR);
|
||||
$newthumbhash->bindParam(":i", $itemid, PDO::PARAM_INT);
|
||||
$newthumbhash->execute();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logSoapFault($result, "Render Mesh ".$itemid." Job", $script);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function wearingAssets($userid) //returns wearing asset list separated by ;
|
||||
{
|
||||
$wearingitems = $GLOBALS['pdo']->prepare('SELECT * FROM wearing_items WHERE uid = :uid ORDER BY aid ASC'); //wearing items from lowest to highest (EZ)
|
||||
|
|
@ -3109,31 +2315,7 @@ function rerenderutility()
|
|||
$setrenderstat = $GLOBALS['pdo']->prepare("UPDATE users SET pendingRender = 1, pendingHeadshotRender = 1, renderCount = renderCount+1, lastRender = UNIX_TIMESTAMP(), lastHeadshotRender = UNIX_TIMESTAMP() WHERE id = :u");
|
||||
$setrenderstat->bindParam(":u", $localplayer, PDO::PARAM_INT);
|
||||
$setrenderstat->execute();
|
||||
RenderPlayer($localplayer);
|
||||
}
|
||||
|
||||
function isPendingRender()
|
||||
{
|
||||
$localplayer = $GLOBALS['user']->id;
|
||||
$check = $GLOBALS['pdo']->prepare("SELECT * FROM users WHERE id = :u");
|
||||
$check->bindParam(":u", $localplayer, PDO::PARAM_INT);
|
||||
$check->execute();
|
||||
$checkdata = $check->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
if ($checkdata->pendingRender == true) //render pending
|
||||
{
|
||||
if (($checkdata->lastRender + 30) < time()) //last render still pending after 30 seconds
|
||||
{
|
||||
$update = $GLOBALS['pdo']->prepare("UPDATE users SET pendingRender = 0 WHERE id = :u");
|
||||
$update->bindParam(":u", $localplayer, PDO::PARAM_INT);
|
||||
$update->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
UsersRender::RenderPlayer($localplayer);
|
||||
}
|
||||
|
||||
function checkUserPendingRender($player)
|
||||
|
|
@ -3339,7 +2521,7 @@ function submitRobloxAssetWorker($requestedassetid, $assettypeid, $assetname, $a
|
|||
$assetid = uploadRobloxMesh($assetname, $assetid, 1);
|
||||
if ($assetid !== FALSE) {
|
||||
$xml=str_replace($mesh, $GLOBALS['url'] . "/asset/?id=" . $assetid, $xml);
|
||||
RenderMesh($assetid);
|
||||
Render::RenderMesh($assetid);
|
||||
} else {
|
||||
$meshuploadsuccess = false;
|
||||
break;
|
||||
|
|
@ -3377,13 +2559,13 @@ function submitRobloxAssetWorker($requestedassetid, $assettypeid, $assetname, $a
|
|||
|
||||
switch ($assettypeid) {
|
||||
case 8:
|
||||
RenderHat($newassetid);
|
||||
Render::RenderHat($newassetid);
|
||||
break;
|
||||
case 18:
|
||||
RenderFace($newassetid);
|
||||
Render::RenderFace($newassetid);
|
||||
break;
|
||||
case 19:
|
||||
RenderGear($newassetid);
|
||||
Render::RenderGear($newassetid);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -3546,13 +2728,13 @@ function approveAsset($id) //currently supports t-shirts, shirts and pants
|
|||
switch ($assettype)
|
||||
{
|
||||
case 2: //TShirt
|
||||
RenderTShirt($id, true);
|
||||
Render::RenderTShirt($id, true);
|
||||
break;
|
||||
case 11: //Shirt
|
||||
RenderShirt($id, true);
|
||||
Render::RenderShirt($id, true);
|
||||
break;
|
||||
case 12: //Pants
|
||||
RenderPants($id, true);
|
||||
Render::RenderPants($id, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -3673,7 +2855,7 @@ function moderateAsset($id) //currently supports t-shirts, shirts and pants
|
|||
|
||||
foreach($assetowners as $owner)
|
||||
{
|
||||
RenderPlayer($owner['uid']);
|
||||
UsersRender::RenderPlayer($owner['uid']);
|
||||
Sleep(2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ Alphaland 2021
|
|||
This is for uploading data from studio, this requires the user to have access to the asset.
|
||||
*/
|
||||
|
||||
use Alphaland\Assets\Render;
|
||||
|
||||
$id = (int)$_GET['id'];
|
||||
|
||||
$iteminfo = getAssetInfo($id);
|
||||
|
|
@ -96,8 +98,7 @@ if($iteminfo !== FALSE) //asset id exists in alphaland db
|
|||
//unlock asset db
|
||||
$pdo->exec("UNLOCK TABLES"); //unlock since we are done with sensitive asset stuff
|
||||
|
||||
RenderModel($iteminfo->id);
|
||||
|
||||
Render::RenderModel($iteminfo->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
/*
|
||||
Alphaland 2021
|
||||
The purpose of this is to upload SolidModels (Unions) from studio, since studio does not serialize the actual Union
|
||||
*/;
|
||||
*/
|
||||
|
||||
use Alphaland\Assets\Render;
|
||||
|
||||
$assetTypeName = $_GET['assetTypeName'];
|
||||
$name = $_GET['name'];
|
||||
|
|
@ -134,9 +135,9 @@ if ($assetTypeName && $name && $isPublic && $allowComments)
|
|||
NULL //ThumbHash
|
||||
);
|
||||
// ...
|
||||
if (!RenderModel($newitem))
|
||||
if (!Render::RenderModel($newitem))
|
||||
{
|
||||
RenderModel($newitem); //if first fail do it again
|
||||
Render::RenderModel($newitem); //if first fail do it again
|
||||
}
|
||||
giveItem($user->id, $newitem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Assets\Render;
|
||||
use Alphaland\Moderation\UserModerationManager;
|
||||
use Alphaland\Users\User;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
|
|
@ -172,7 +173,7 @@ if(isset($_GET['id']))
|
|||
if ($itemtypeint == 8)
|
||||
{
|
||||
//Hat
|
||||
if (!RenderHat($id))
|
||||
if (!Render::RenderHat($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Hat Failed</div>";
|
||||
}
|
||||
|
|
@ -184,7 +185,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 2)
|
||||
{
|
||||
//T Shirt
|
||||
if (!RenderTShirt($id))
|
||||
if (!Render::RenderTShirt($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render TShirt Failed</div>";
|
||||
}
|
||||
|
|
@ -196,7 +197,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 4)
|
||||
{
|
||||
//Mesh
|
||||
if (!RenderMesh($id))
|
||||
if (!Render::RenderMesh($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render TShirt Failed</div>";
|
||||
}
|
||||
|
|
@ -208,7 +209,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 11)
|
||||
{
|
||||
//Shirt
|
||||
if (!RenderShirt($id))
|
||||
if (!Render::RenderShirt($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Shirt Failed</div>";
|
||||
}
|
||||
|
|
@ -220,7 +221,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 12)
|
||||
{
|
||||
//Pants
|
||||
if (!RenderPants($id))
|
||||
if (!Render::RenderPants($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Pants Failed</div>";
|
||||
}
|
||||
|
|
@ -232,7 +233,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 18)
|
||||
{
|
||||
//Faces
|
||||
if (!RenderFace($id))
|
||||
if (!Render::RenderFace($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Face Failed</div>";
|
||||
}
|
||||
|
|
@ -244,7 +245,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 19)
|
||||
{
|
||||
//Gears
|
||||
if (!RenderGear($id))
|
||||
if (!Render::RenderGear($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Gear Failed</div>";
|
||||
}
|
||||
|
|
@ -256,7 +257,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 17)
|
||||
{
|
||||
//Heads
|
||||
if (!RenderHead($id))
|
||||
if (!Render::RenderHead($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Head Failed</div>";
|
||||
}
|
||||
|
|
@ -268,7 +269,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 32)
|
||||
{
|
||||
//Packages
|
||||
if (!RenderPackage($id))
|
||||
if (!Render::RenderPackage($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Package Failed</div>";
|
||||
}
|
||||
|
|
@ -280,7 +281,7 @@ if(isset($_GET['id']))
|
|||
elseif ($itemtypeint == 10)
|
||||
{
|
||||
//Models
|
||||
if (!RenderModel($id))
|
||||
if (!Render::RenderModel($id))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Render Model Failed</div>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Assets\Render;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
|
@ -158,7 +159,7 @@ $alert = '';
|
|||
|
||||
//render
|
||||
|
||||
if (!RenderHat($autoincrement))
|
||||
if (!Render::RenderHat($autoincrement))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Error Rendering Hat, it's been uploaded but not Rendered</div>";
|
||||
}
|
||||
|
|
@ -272,7 +273,7 @@ $alert = '';
|
|||
|
||||
//render
|
||||
|
||||
if (!RenderFace($autoincrement))
|
||||
if (!Render::RenderFace($autoincrement))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Error Rendering face, it's been uploaded but not Rendered</div>";
|
||||
}
|
||||
|
|
@ -433,7 +434,7 @@ $alert = '';
|
|||
}
|
||||
// ...
|
||||
|
||||
if (!RenderHead($autoincrement))
|
||||
if (!Render::RenderHead($autoincrement))
|
||||
{
|
||||
$alert = "<div class='alert alert-danger' role='alert'>Error Rendering Head, it's been uploaded but not Rendered</div>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Alphaland\Users\Render;
|
||||
use Alphaland\Web\WebContextManager;
|
||||
|
||||
WebContextManager::ForceHttpsCloudflare();
|
||||
|
|
@ -12,7 +13,7 @@ adminPanelStats();
|
|||
|
||||
if(isset($_POST['renderplayer']))
|
||||
{
|
||||
RenderPlayer($_POST['userid']);
|
||||
Render::RenderPlayer($_POST['userid']);
|
||||
}
|
||||
|
||||
$body = <<<EOT
|
||||
|
|
|
|||
|
|
@ -11,7 +11,14 @@
|
|||
]]
|
||||
|
||||
|
||||
local userid, url, asseturl, fileExtension, x, y, quadratic, OnlyCheckHeadAccessoryInHeadShot, angleRight, angleLeft, baseHatZoom, maxHatZoom, cameraOffsetX, cameraOffsetY = ...
|
||||
local userid, url, asseturl, fileExtension, x, y, angleRight, angleLeft = ...
|
||||
|
||||
local quadratic = false
|
||||
local OnlyCheckHeadAccessoryInHeadShot = false
|
||||
local baseHatZoom = 0
|
||||
local maxHatZoom = 90
|
||||
local cameraOffsetX = 0
|
||||
local cameraOffsetY = -0.1
|
||||
|
||||
print ('Render Player Closeup ' .. userid);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue