[СПЕШНО]Вграждан е на код в аватар

GameZone

Registered
Можете ли да ми вградите кода за правене на картинката 150х150 и при качване да няма размери който да са задължителни качва каквато си иска картинка с каквито си иска разбери и то автоматично да я прави 150х150 от този урок:
http://web-tourist.net/login/login/view.php?st=2244

В мод код:
<?php
session_start();
require "config.php";
$sesuser = $_COOKIE['login'];

if ($sesuser != "") {

if (isset($_GET[remove])) {

$filename = 'avatars/'.$sesuser.'.gif';

if (file_exists($filename)) {

echo "<meta http-equiv='refresh' content='1;url=index.php?page=profile&p=avatar' />";

unlink($filename);

}

}

echo "<hr>";


$maxwidth = "150";

$maxheight = "150";



if (isset($_POST['submit'])) {

$filetype = $_FILES['userfile']['type'];

$filetypex = substr($filetype,0,5);



if ($filetypex == image) {

$newid = "avatars/";

$newid .= "$sesuser";

$newid .= ".gif";





$mysock = getimagesize($_FILES['userfile']['tmp_name']);

$imagewidth = $mysock[0];

$imageheight = $mysock[1];

if ($imagewidth <= "$maxwidth" && $imageheight <= "$maxheight") {

if(!(copy($_FILES['userfile']['tmp_name'], $newid))) die("Cannot upload files!");

echo "<table width='80%' class='done1' align='center'>
<tr>
<td class='done' align='left' rowspan='4' width='5%'>
<img src='images/done_button.png' border='0' width='33' height='33'>
</td>
<td align='left' width='90%'><span style='font-weight: bold;'><font color='0ff000'>Аватара е променен успешно!</span></td>
<td class='done' align='right' rowspan='4' width='5%'>
</td>
</tr>
</table>";

}

else {

echo "<table width='80%' class='error1' align='center'>
<tr>
<td class='error' align='left' rowspan='4' width='5%'>
<img src='images/error_button.png' border='0' width='33' height='33'>
</td>
<td align='left' width='90%'><span style='font-weight: bold;'><font color='ff0000'>Максимални размери на аватара: 150х150px</font></span></td>
<td class='error' align='right' rowspan='4' width='5%'>
</td>
</tr>
</table>";

}

}

else {
echo "<table width='80%' class='error1' align='center'>
<tr>
<td class='error' align='left' rowspan='4' width='5%'>
<img src='images/error_button.png' border='0' width='33' height='33'>
</td>
<td align='left' width='90%'><span style='font-weight: bold;'><font color='ff0000'>Файлът не е изображение!</font></span></td>
<td class='error' align='right' rowspan='4' width='5%'>
</td>
</tr>
</table>";

}

}

else {

$filename = 'avatars/'.$sesuser.'.gif';

if (file_exists($filename)) {

echo "<table class='play' border='0' cellspacing='2' cellpadding='2'>
<tr>
<td colspan='3' valign='top'>";
echo '<img src="'.$filename.'" border="0"></td></tr>';
echo '<tr><td class="play" align="center"><a href="index.php?page=profile&p=avatar&remove"><font color="ff0000">Премахни</font></a>';
echo '</td></tr></table><br />';

}

else {

echo "<img src='avatars/avatar.png' border='0'><br /><br />";
echo "<form action='' method='post' enctype='multipart/form-data'>

<input type='file' name='userfile' class='input'><br />

<br />

<input type='submit' value='Промен' name='submit' class='btn'>";

}

}

}

else {
echo "Трябва да си логнат";
}
?>
 

Back
Горе