Проблем с imagecopyresized

Evanescence

Registered
Код:
<?php
require('../inc/config.php');
if (isset($_POST['submit'])){
$image_caption = $_POST['image_caption'];
$image_country = $_POST['image_country'];
$image_model = $_POST['image_model'];
$image_year = $_POST['image_year'];
$image_small = $_FILES['image_small']['name'];


$imgdir = 'img/';
$imgname = $imgdir . $image_small;
if (move_uploaded_file($_FILES['image_small']['tmp_name'],$imgname)){
list($width,$height,$type,$attr) = getimagesize($imgname);

imagecopyresized($imgname, $imgdir.$imgname, 0, 0, 0, 0, 150, 113, $width, $height);

$insert = "INSERT INTO images (image_caption,image_country,image_year,image_model,image_small) VALUES 
('$image_caption','$image_country','$image_year','$image_model','$image_small')";
$insertdone = mysql_query($insert) or die (mysql_error());
}
echo "Промените са добавени!";
}
?>
Картинката не се запазва с новите размери и ми дава предупреждение:

Код:
Warning: imagecopyresized() expects parameter 1 to be resource, string given in C:\xampp\htdocs\radio\adm\add.php on line 16
[/code]
 

Back
Горе