Xwab
Форумыnavigate_nextНебольшие вопросы по PHP/MySQL

миниатюра.
Сообщения
apple

есть такое:
[php:1:40ae8595d2]$upfile = '../../../user/media/fotos/photos/'.$new_filename;
$img_src = $_FILES["userfile"]["name"];
$width = 120;

//Ensure the image exists
if(file_exists($img_src)){
//Create image stream
$image = imagecreatefromjpeg($img_src);

//Gather and store the width and height
list($image_width, $image_height) = getimagesize($img_src);

//Calculate new height while mantaining apsect ratio
$height = (($width / $image_width) * $image_height);

//Resample/resize the image
$tmp_img = imagecreatetruecolor($width, $height);
imagecopyresampled($tmp_img, $image, 0, 0, 0, 0, $width, $height, $image_width, $image_height);





imagejpeg($tmp_img, $upfile, 100);
//Free memory
imagedestroy($tmp_img);
imagedestroy($image);
}
else {
echo 'File not found!';
}[/php:1:40ae8595d2]
тут есть условие: if(file_exists($img_src)) это, на сколько я понимаю,
оно проверяет существует ли файл? так вот, это условие возвращает ложь
почти всегда. у меня только одна фотка загружается. ко всем остальным
выводит 'File not found! хотя формат у всех один - jpeg

30 Мар 2013, 12:38
SL_NeKrOmAnT

Проверяй файл на существование которые в папку залил, а не тот, что во временной папке лежит.

30 Мар 2013, 15:41
Ответить на тему