Войти или зарегистрироваться
  • Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.
  • Данный раздел создан исключительно для релизов! Вопросы по лаунчеру или обвязке задавайте ТОЛЬКО в соответсвующей теме автора. Любые другие темы будут удалены, а авторы понесут наказание.

Веб Новый стиль смены скина/плаща[Теперь HD]

Хмм. Слушайте, проблема. Полазил в гугль и не нашёл ответа. Когда в стат страницу пишу
{include file='engine/modules/skins/index.php'} то на той странице оно показывается текстом.
Исходный текст HTML без фильтрации и изменений - включено. В чем проблема может быть? ДЛЕ последний. Не помню точно версию. 9.8 что-ле.



UPD В шаблоны сайта встраивается. Но работает не корректно.
в dle 9.8 не робит инклюд
 
Dle 9,7 дефолтный скин не видит!
 
И так, новая проблема. Поискал какие строчки за нее отвечают, но ничего не вырыл. В ПХП - я НОЛЬ без палочки. ХТМЛ - на уровне "Выше плинтуса"



Не подскажете в каких строчках редактировать? Мне что-то подсказывает, что это в файле skin2d.пхп нужно менять что-то

[PHP2]<?php
class Skin2d {
private $image = NULL;

function __destructor () {
if ($this->image != NULL) {
imagedestroy($this->image);
}
}

function AssignSkinFromFile ($file) {
if ($this->image != NULL) {
imagedestroy($this->image);
}
if(($this->image = imagecreatefrompng($file)) == False) {
// Error occured
throw new Exception("Could not open PNG file.");
}
if(!$this->Valid()) {
throw new Exception("Invalid skin image.");
}
}

function AssignSkinFromString ($data) {
if ($this->image != NULL) {
imagedestroy($this->image);
}
if(($this->image = imagecreatefromstring($data)) == False) {

throw new Exception("Could not load image data from string.");
}
if(!$this->Valid()) {
throw new Exception("Invalid skin image.");
}
}

function Width () {
if($this->image != NULL) {
return imagesx($this->image);
} else {
throw new Exception("No skin loaded.");
}
}

function Height () {
if($this->image != NULL) {
return imagesy($this->image);
} else {
throw new Exception("No skin loaded.");
}
}

function Valid () {
return ($this->Width() != 64 || $this->Height() != 32) ? False : True;
}

function FrontImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 16 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(16, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 16, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 8, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 40, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 20, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 44, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 44, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 16, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function BackImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 16 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(16, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 16, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 24, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 56, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 32, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 52, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 52, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 16, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function CombinedImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 37 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(37, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 37, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 8, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 40, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 20, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 44, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 44, 20, 4, 12);

imagecopy($newImage, $this->image, 25, 0, 24, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 25, 0, 56, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 25, 8, 32, 20, 8, 12);
imagecopy($newImage, $this->image, 29, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 25, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 33, 8, 52, 20, 4, 12);
imagecopy($newImage, $this->image, 21, 8, 52, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 37, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function imagecopyalpha($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $h, $bg) {
for($i = 0; $i < $w; $i++) {
for($j = 0; $j < $h; $j++) {

$rgb = imagecolorat($src, $src_x + $i, $src_y + $j);

if(($rgb & 0xFFFFFF) == ($bg & 0xFFFFFF)) {
$alpha = 127;
} else {
$colors = imagecolorsforindex($src, $rgb);
$alpha = $colors["alpha"];
}
imagecopymerge($dst, $src, $dst_x + $i, $dst_y + $j, $src_x + $i, $src_y + $j, 1, 1, 100 - (($alpha / 127) * 100));
}
}
}
}
?><?php
$path = $_GET[skinpath];
$test = new Skin2d();
$test->AssignSkinFromFile($path);

header('Content-type: image/png' || 'Content-type: image/x-png');
$img = $test->CombinedImage(5);
imagepng($img);
imagedestroy($img);
?>[/code]
 
И так, новая проблема. Поискал какие строчки за нее отвечают, но ничего не вырыл. В ПХП - я НОЛЬ без палочки. ХТМЛ - на уровне "Выше плинтуса"



Не подскажете в каких строчках редактировать? Мне что-то подсказывает, что это в файле skin2d.пхп нужно менять что-то

[PHP2]<?php
class Skin2d {
private $image = NULL;

function __destructor () {
if ($this->image != NULL) {
imagedestroy($this->image);
}
}

function AssignSkinFromFile ($file) {
if ($this->image != NULL) {
imagedestroy($this->image);
}
if(($this->image = imagecreatefrompng($file)) == False) {
// Error occured
throw new Exception("Could not open PNG file.");
}
if(!$this->Valid()) {
throw new Exception("Invalid skin image.");
}
}

function AssignSkinFromString ($data) {
if ($this->image != NULL) {
imagedestroy($this->image);
}
if(($this->image = imagecreatefromstring($data)) == False) {

throw new Exception("Could not load image data from string.");
}
if(!$this->Valid()) {
throw new Exception("Invalid skin image.");
}
}

function Width () {
if($this->image != NULL) {
return imagesx($this->image);
} else {
throw new Exception("No skin loaded.");
}
}

function Height () {
if($this->image != NULL) {
return imagesy($this->image);
} else {
throw new Exception("No skin loaded.");
}
}

function Valid () {
return ($this->Width() != 64 || $this->Height() != 32) ? False : True;
}

function FrontImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 16 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(16, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 16, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 8, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 40, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 20, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 44, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 44, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 16, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function BackImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 16 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(16, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 16, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 24, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 56, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 32, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 52, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 52, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 16, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function CombinedImage ($scale = 1, $r = 156, $g = 156, $b = 156) {
$newWidth = 37 * $scale;
$newHeight = 32 * $scale;

$newImage = imagecreatetruecolor(37, 32);
$background = imagecolorallocate($newImage, $r, $g, $b);
imagefilledrectangle($newImage, 0, 0, 37, 32, $background);

imagecopy($newImage, $this->image, 4, 0, 8, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 4, 0, 40, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 4, 8, 20, 20, 8, 12);
imagecopy($newImage, $this->image, 8, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 4, 20, 4, 20, 4, 12);
imagecopy($newImage, $this->image, 12, 8, 44, 20, 4, 12);
imagecopy($newImage, $this->image, 0, 8, 44, 20, 4, 12);

imagecopy($newImage, $this->image, 25, 0, 24, 8, 8, 8);
$this->imagecopyalpha($newImage, $this->image, 25, 0, 56, 8, 8, 8, imagecolorat($this->image, 63, 0));
imagecopy($newImage, $this->image, 25, 8, 32, 20, 8, 12);
imagecopy($newImage, $this->image, 29, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 25, 20, 12, 20, 4, 12);
imagecopy($newImage, $this->image, 33, 8, 52, 20, 4, 12);
imagecopy($newImage, $this->image, 21, 8, 52, 20, 4, 12);

if($scale != 1) {
$resize = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresized($resize, $newImage, 0, 0, 0, 0, $newWidth, $newHeight, 37, 32);
imagedestroy($newImage);
return $resize;
}

return $newImage;
}

function imagecopyalpha($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $w, $h, $bg) {
for($i = 0; $i < $w; $i++) {
for($j = 0; $j < $h; $j++) {

$rgb = imagecolorat($src, $src_x + $i, $src_y + $j);

if(($rgb & 0xFFFFFF) == ($bg & 0xFFFFFF)) {
$alpha = 127;
} else {
$colors = imagecolorsforindex($src, $rgb);
$alpha = $colors["alpha"];
}
imagecopymerge($dst, $src, $dst_x + $i, $dst_y + $j, $src_x + $i, $src_y + $j, 1, 1, 100 - (($alpha / 127) * 100));
}
}
}
}
?><?php
$path = $_GET[skinpath];
$test = new Skin2d();
$test->AssignSkinFromFile($path);

header('Content-type: image/png' || 'Content-type: image/x-png');
$img = $test->CombinedImage(5);
imagepng($img);
imagedestroy($img);
?>[/code]
Что именно сделать-то надо?
 
Хмм. Слушайте, проблема. Полазил в гугль и не нашёл ответа. Когда в стат страницу пишу
{include file='engine/modules/skins/index.php'} то на той странице оно показывается текстом.
Исходный текст HTML без фильтрации и изменений - включено. В чем проблема может быть? ДЛЕ последний. Не помню точно версию. 9.8 что-ле.



UPD В шаблоны сайта встраивается. Но работает не корректно.
В дле 9.8 убраны инклуды используй этот гайд ТЫК, или переделай сайт под 9.7
 
Ответь хотя бы ты - зачем тебе лайки?
Причем тут это? И мне лайки как-то не нужны, и без них хорошо живется. Мне запрещено помогать, или я обязан писать что-то вроде "обязательно скажи спасибо автору статьи"?
 

Поделиться этой страницей

Назад
Верх