在php中创建缩略图。图像不是';不保存在文件中

在php中创建缩略图。图像不是';不保存在文件中,php,thumbnails,Php,Thumbnails,我正在尝试在我的php应用程序中保存图像缩略图。我有以下代码,但缩略图不能存储在文件images/{image\u name}中 $image_temp = $_FILES['uploaded_file']['tmp_name']; $image_size = $_FILES['uploaded_file']['size']; $image_name = $_FILES['uploaded_file']['name']; $image_type = $_FILES['uploaded_file'

我正在尝试在我的php应用程序中保存图像缩略图。我有以下代码,但缩略图不能存储在文件images/{image\u name}中

$image_temp = $_FILES['uploaded_file']['tmp_name'];
$image_size = $_FILES['uploaded_file']['size'];
$image_name = $_FILES['uploaded_file']['name'];
$image_type = $_FILES['uploaded_file']['type'];
$size2 = getimagesize($image_temp);
$width = $size2[0];
$height = $size2[1];    
$thumbs_destination = 'images/'.$image_name;

$newwidth = 100;
$newheight = 100;
$img = imagecreatefromjpeg($image_temp);
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, $thumbs_destination);

我想使用我自己的代码,而不是一个插件或一些已经发布在论坛上的代码,因此我需要你的帮助

你能在这里添加表单代码吗?你能缩小问题的范围吗,例如通过在屏幕上回显图像并检查
imagejpeg()的返回值
?您是否确保您拥有写入
图像
目录的正确权限?表单代码为:Form enctype=“multipart/Form data”action=”“method=“POST”>选择要上载的文件:我确信我拥有正确的权限,因为我还使用了move\u uploaded\u文件,并且工作正常。变量$image\u temp、$image\u size、$image\u name、$image\u type、$size2、$width、$height、$thumbs\u destination具有它们应该具有的值,我还尝试了echo$img、echo$thumb、echo imagecopyresampled()和echo imagejpeg(),但屏幕上没有打印任何内容(我不确定这些变量是否应该返回结果)。