PHPThumb不生成缩略图为什么?
以下是我的PHP代码:PHPThumb不生成缩略图为什么?,php,phpthumb,Php,Phpthumb,以下是我的PHP代码: require_once('phpthumb/phpthumb.class.php'); $phpThumb = new phpThumb(); $output_format = 'jpg'; $image_heights = array(141, 424, 990); $image_widths = array(100, 300, 700); $counter = sizeof($_FILES["img"]["tmp_name"]); $count = 0; $valu
require_once('phpthumb/phpthumb.class.php');
$phpThumb = new phpThumb();
$output_format = 'jpg';
$image_heights = array(141, 424, 990);
$image_widths = array(100, 300, 700);
$counter = sizeof($_FILES["img"]["tmp_name"]);
$count = 0;
$values = array();
foreach ($_FILES["img"]["tmp_name"] as $array_number => $holding_value)
{
$date = getTime();
$tmp_img_name = $_SESSION["username"]."_".$date["timestamp"]."."."jpg";
if(move_uploaded_file($holding_value, $temp."/".$tmp_img_name))
{
$phpThumb->resetObject();
$phpThumb->setSourceFilename($temp."/".$tmp_img_name);
$phpThumb->setParameter('config_output_format', $output_format);
if($count == 0)
{
$phpThumb->setParameter('h', $image_heights[$count]);
$phpThumb->setParameter('w', $image_widths[$count]);
$phpThumb->setParameter('q', 90);
$store_filename = $path1."_".$tmp_img_name;
}
if($count == 1)
{
$phpThumb->setParameter('h', $image_heights[$count]);
$phpThumb->setParameter('w', $image_widths[$count]);
$phpThumb->setParameter('q', 90);
$store_filename = $path2."_".$tmp_img_name;
}
if($count == 2)
{
$phpThumb->setParameter('h', $image_heights[$count]);
$phpThumb->setParameter('w', $image_widths[$count]);
$phpThumb->setParameter('q', 80);
$store_filename = $path3."_".$tmp_img_name;
}
if($phpThumb->GenerateThumbnail())
{
if($phpThumb->RenderToFile($store_filename))
{
$values[] = $store_filename;
// include '../../src/Cloudinary.php';
// include '../../src/Uploader.php';
// \Cloudinary::config(array
// (
// "cloud_name" => "dczebgs6w",
// "api_key" => "328212291514632",
// "api_secret" => "LvhRA-s59TZ30rPhCieTVx8LzIw"
// ));
// $cloudUpload = \Cloudinary\Uploader::upload($store_filename, array("timeout" => 120));
// if($cloudUpload)
}
else
{
//unable to write file to final destination directory - check folder permissions
$message= "Error! Please try again (render).";
}
}
else
{
$message= "Error! Please try again (generate).";
}
}
$count++;
unlink($temp."/".$tmp_img_name);
}
// print_r($values);
代码的问题是,在这一行代码之前,一切都正常=>if(move\u upload\u file($holding\u value,$temp./“$tmp\u img\u name))
我甚至检查了图像是否正在上传,因此将其上传到目录中。但是,不知何故,我无法生成THMBnail。为什么会这样
他们在每一个循环和每一行都检查了我的代码。只上载临时图像,但不上载缩略图
请帮我输入这个代码。提前谢谢_/_
生成缩略图时没有生成缩略图/出现问题。有错误吗?您是否尝试跟踪代码以检查哪个部分不能按预期工作?不,没有错误,但它会在临时位置上载文件,但由于$count的值不同,它会进一步生成缩略图,因此不会执行它。它会进入我为count给定的每个条件,但不会生成缩略图并存储在文件夹中。生成缩略图时出现问题。