Php 如何在codeigniter中移动缩略图以指定文件夹
我从使用ffmpeg的视频中得到了一个缩略图。现在,缩略图存储在根文件夹项目目录中,但我想将其移动到特定文件夹。怎么做?我得到了一个缩略图使用以下Php 如何在codeigniter中移动缩略图以指定文件夹,php,ffmpeg,codeigniter-3,Php,Ffmpeg,Codeigniter 3,我从使用ffmpeg的视频中得到了一个缩略图。现在,缩略图存储在根文件夹项目目录中,但我想将其移动到特定文件夹。怎么做?我得到了一个缩略图使用以下 <!DOCTYPE html> <html> <body> <form action="upld.php" method="post" enctype="multipart/form-data"> Select image to upload: <in
<!DOCTYPE html>
<html>
<body>
<form action="upld.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload" name="submit">
</form>
<?php
if(isset($_POST['submit'])){
$ffmpeg = "C:\\ffmpeg\\bin\\ffmpeg";
$videoFile = $_FILES["fileToUpload"]["tmp_name"];
$imageFile = "4.jpg";
$size = "120*90";
$getFromSecond = 5;
$cmd = "$ffmpeg -i $videoFile -an -ss $getFromSecond -s $size $imageFile";
if(!shell_exec($cmd)){
echo "Thumbnail created";
} else {
echo "error while Thumbnail creating";
}
}
?>
</body>
</html>
选择要上载的图像:
用户代码点火器的图像处理类。您可以在这里找到文档
这对你有帮助
$filename = $this->input->post('fileToUpload');
$source_path = FCPATH . '/uploads/source/tmp/' . $filename;
$target_path = FCPATH. '/uploads/thumb/';
$config_manip = array(
'image_library' => 'gd2',
'source_image' => $source_path,
'new_image' => $target_path,
'maintain_ratio' => TRUE,
'create_thumb' => TRUE,
'thumb_marker' => '_thumb',
'width' => 150,
'height' => 150
);
$this->load->library('image_lib', $config_manip);
if (!$this->image_lib->resize()) {
echo $this->image_lib->display_errors();
}
// clear //
$this->image_lib->clear();