在php中创建缩略图。图像未保存在文件中

时间:2014-03-24 16:50:42

标签: php thumbnails

我试图在我的php应用中保存图片缩略图。我有以下代码,但缩略图无法存储在文件images / {image_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);

我想使用自己的代码,而不是插件或已经在论坛中发布的代码,所以我需要你的帮助

0 个答案:

没有答案