Искам да попитам как да направя така че да се слага воден знак на сяка акчена картинка на системата на hunter за качване на фаилове ето и кода
upload.php
functions.php
как ше стане :? :? :?
upload.php
Код:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Upload</title>
</head>
<body>
<?php
require "config.php";
require "functions.php";
$error = '';
if (isset($_POST['submit']) && !empty($_FILES['pic']['name']) && !empty($_POST['subject']))
{
if (in_array(strtolower(end(explode(".", $_FILES['pic']['name']))), $exp_pic))
{
if ($_FILES['pic']['size'] > 0 && $_FILES['pic']['size'] <= ($max_size_pic * 1024))
{
$file_copy = preg_replace("/([\/])+/", "\\1", $file_copy."/");
$ex_pic = end(explode(".", $_FILES['pic']['name']));
$new_name_pic = new_name($ex_pic);
while (file_exists($file_copy.$new_name_pic)) { $new_name_pic = new_name($ex_pic); }
if (@copy($_FILES['pic']['tmp_name'], $file_copy.$new_name_pic))
{
mysql_query("INSERT INTO `files` (`pic`,`subject`) VALUES ('".$file_copy.$new_name_pic."','".htmlspecialchars($_POST['subject'])."')");
$error = "Файла беше качен успешно!";
}
else
{
$error = "Файла не беше качен!";
}
}
else
{
$error = "Картинката не трябва да превишава $max_size_pic KB!";
}
}
else
{
$error = "Позволени са само следните разширения за картинка: ".implode(",", $exp_pic);
}
}
?>
<b><u>Всички полета са задължителни!</u></b>
<form action="" enctype="multipart/form-data" method="post">
<table border="0">
<tr><td>Изберете картинка:</td><td><input type="file" name="pic"></td></tr>
<tr><td>Описание:</td><td><textarea name="subject" rows="5" cols="30"></textarea></td></tr>
</table>
<input type="submit" name="submit" value="Изпрати">
</form>
<b><?=$error?></b>
</body>
</html>
functions.php
Код:
<?php
function new_name($exp)
{
$simbols = "1234567890qwertyuiopasdfgjklzxcvbnm";
return substr(str_shuffle($simbols), 0, 25).".".$exp;
}
function sakra6tenie($var)
{
global $max_simbols;
if (strlen($var) > $max_simbols)
{
return nl2br(substr($var, 0, $max_simbols))."...";
}
else
{
return nl2br($var);
}
}
function resize($pic)
{
global $max_width_pic,$max_height_pic;
list($width,$height) = getimagesize($pic);
$ratio = $width / $height;
if ($width > $max_width_pic || $height > $max_height_pic)
{
if ($width > $height)
{
$width = $max_width_pic;
$height = $width / $ratio;
}
elseif ($width < $height)
{
$height = $max_height_pic;
$width = $height * $ratio;
}
elseif ($width == $height)
{
$width = $max_width_pic;
$height = $max_height_pic;
}
}
$width = intval($width);
$height = intval($height);
return array("width" => $width, "height" => $height);
}
?>
как ше стане :? :? :?