Файл: DARK WARS/dark_war/class/world_map_little.class.php
Строк: 27
<?php
class world_map_little {
private $is_name;
private $w;
private $h;
private $lastW;
public $lastH;
private $id;
function read_map_little($w, $h, $name, $count) {
$img = @imagecreatefromjpeg(H."/dark_war/files/world_map_little/$name.jpg");
$screen = @imagecreatefromjpeg(H."/dark_war/all_img/world_map_little/$count.jpg");
imagecopy($img,$screen,$w,$h,0,0,17,17);
imagejpeg($img,H."/dark_war/files/world_map_little/$name.jpg",100);
}
function one_user_map($w, $h, $lastW, $lastH, $name, $id) {
$img = @imagecreatefromjpeg(H."/dark_war/all_img/world_map_little/world_map.jpg");
$screen = @imagecreatefromjpeg(H."/dark_war/all_img/world_map_little/user.jpg");
imagecopy($img,$screen,$w,$h,0,0,17,17);
imagejpeg($img,H."/dark_war/files/world_map_little/$name.jpg",100);
$this->is_name = $name;
$this->w = $w;
$this->h = $h;
$this->lastW = $lastW;
$this->lastH = $lastH;
$this->id = $id;
}
function __destruct() {
$img = @imagecreatefromjpeg(H."/dark_war/files/world_map_little/".$this->is_name .".jpg ");
$screen1=imagecreatetruecolor(400, 200);
//////////////////////////////////////// Запоминаем новый отступ для вырезки карты
if ($this->w > ($this->lastW + 300)) {
$this->lastW = $this->w;
mysql_query("UPDATE `dark_war_users` SET `lastW` = '".$this->lastW."' WHERE `id` = '".$this->id."' ");
}
if ($this->h > ($this->lastH + 180)) {
$this->lastH = $this->h;
mysql_query("UPDATE `dark_war_users` SET `lastH` = '".$this->lastH."' WHERE `id` = '".$this->id."' ");
}
////////////////////////////// <<<<<<------||
///////////////////////////////// Максимальный отступ вырезаной карты не больше чем 600
if ($this->w > 600) {
$this->lastW = 600;
}
if ($this->h > 600) {
$this->lastH = 600;
}
///////////////////////////////// <<<<<<------||
////////////////////////////////// чтобы отступы вырезаной карты не вышли за края
if ($this->w < $this->lastW) {
$this->lastW = $this->w - 300;
if ($this->lastW <= 0) {
$this->lastW = 0;
}
mysql_query("UPDATE `dark_war_users` SET `lastW` = '".$this->lastW."' WHERE `id` = '".$this->id."' ");
}
if ($this->h < $this->lastH) {
$this->lastH = $this->h - 180;
if ($this->lastH <= 0) {
$this->lastH = 0;
}
mysql_query("UPDATE `dark_war_users` SET `lastH` = '".$this->lastH."' WHERE `id` = '".$this->id."' ");
}
/////////////////////////////////////////// <<<<<<--------||
imagecopyresampled($screen1,$img,0,0,$this->lastW,$this->lastH,400,200,400,200);
imagejpeg($screen1,H."/dark_war/files/world_map_little/".$this->is_name.".jpg",80);
}
}
?>