Изображение не обновляется
На моём сайте (clavaqwerty.xyz/robinsnest/index.php) есть страница личного аккаунта, где можно изменить аватар, но при его изменении ничего не происходит до того момента, пока вы не обновите кэш браузера, понятное дело, что пользователи не станут маяться этим, поэтому нужно исправить проблему (я думаю, что она связана с кэшированием). Прилагаю код страницы личного аккаунта profile.php:
<?php
require_once 'header.php';
echo "<meta http-equiv='Cache-Control' content='no-cache'>";
if (!$loggedin) die();
echo "<div class='main'><h3>Ваш профайл</h3>";
$result = queryMysql("SELECT * FROM profiles WHERE user='$user'");
if (isset($_POST['text']))
{
$text = sanitizeString($_POST['text']);
$text = preg_replace('/\s\s+/', ' ', $text);
if ($result->num_rows)
queryMysql("UPDATE profiles SET text='$text' where user='$user'");
else queryMysql("INSERT INTO profiles VALUES('$user', '$text')");
}
else
{
if ($result->num_rows)
{
$row = $result->fetch_array(MYSQLI_ASSOC);
$text = stripslashes($row['text']);
}
else $text = "";
}
$text = stripslashes(preg_replace('/\s\s+/', ' ', $text));
if (isset($_FILES['image']['name']))
{
$saveto = "$user.jpg";
move_uploaded_file($_FILES['image']['tmp_name'], $saveto);
$typeok = TRUE;
if ($_FILES['img']['error']==4){
die('Not uploaded');
}
switch($_FILES['image']['type'])
{
case "image/gif": $src = imagecreatefromgif($saveto); break;
case "image/jpeg": // Both regular and progressive jpegs
case "image/pjpeg": $src = imagecreatefromjpeg($saveto); break;
case "image/png": $src = imagecreatefrompng($saveto); break;
default: $typeok = FALSE; break;
}
if ($typeok)
{
list($w, $h) = getimagesize($saveto);
$max = 100;
$tw = $w;
$th = $h;
if ($w > $h && $max < $w)
{
$th = $max / $w * $h;
$tw = $max;
}
elseif ($h > $w && $max < $h)
{
$tw = $max / $h * $w;
$th = $max;
}
elseif ($max < $w)
{
$tw = $th = $max;
}
$tmp = imagecreatetruecolor($tw, $th);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $tw, $th, $w, $h);
imageconvolution($tmp, array(array(-1, -1, -1),
array(-1, 16, -1), array(-1, -1, -1)), 8, 0);
imagejpeg($tmp, $saveto);
imagedestroy($tmp);
imagedestroy($src);
}
}
showProfile($user);
echo <<<_END
<form method='post' action='profile.php' enctype='multipart/form-data'>
<h3>Напишите статус и поставьте аватар</h3>
<textarea name='text' cols='50' rows='3'>$text</textarea><br>
_END;
?>
Фотошка: <input type='file' name='image' size='14'>
<input type='submit' value='Сохранить'>
</form></div><br>
</body>
</html>
Надеюсь на вашу помощь, достопочтенные герои Stack Overflow!