我正在使用来自https://www.verot.net/的课程上传创建上传图片 我的问题:输出图像2(真实照片和编辑 - 调整大小照片)。 所有的工作,但它在处理上传时浪费时间。 当我在上传前后检查尺寸真实照片时,尺寸不一样。
$counter=1;
foreach ($files as $file) {
$handle = new Upload($file);
if ($handle->uploaded)
{
$handle->Process("real");
$handle->dir_chmod = 0777;
//$handle->jpeg_quality = 85;
//jenis file yang diijinkan
$handle->allowed = array('image/*');//VALIDASI UPLOAD GAMBAR
//$handle->image_resize = false;
/*----first-START----*/
if ($handle->processed) {
${'pathPhotoReal'.$counter} = 'real/'.$handle->file_dst_name;
echo ${'pathPhotoReal'.$counter}."<br>";
${'namaFoto'.$counter} = $_POST['text'.$counter];
echo ${'namaFoto'.$counter}."<br>";
}
else {
// one error occured
echo ' Error: ' . $handle->error . '';
}
/*----first-FINISH----*/
// we now process the image a second time, with some other settings
//$handle->allowed = array('image/*');
$handle->image_ratio = true;
$handle->image_ratio_fill = true;
$handle->image_resize = true;
$handle->image_x = 300;
$handle->image_y = 300;
$handle->Process('edit');
/*----second-START----*/
if ($handle->processed) {
${'pathFotoEdit'.$counter} = 'edit/'.$handle->file_dst_name;
echo ${'pathFotoEdit'.$counter}."<br>";
}
else {
// one error occured
echo ' Error: ' . $handle->error . '';
}
/*----second-FINISH----*/
$counter = $counter + 1;
//$handle->clean();
else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
echo ' File not upload ' . $handle->error . '';
echo($handle->log);
}
}
在我的上一个代码中使用else { echo'File not upload'。 $ handle-&gt;错误。 ''; } 它始终显示,文件夹中的路径照片已将照片保存在里面。我认为上传成功。
答案 0 :(得分:1)
尝试从filezilla更改文件夹权限。 有了这个,你就可以知道服务器是否允许你制作那些persmisos