Php Blueimp jQuery文件上载-从数据库中列出图像
我需要帮助。请告诉我 我使用blueimpjquery文件上传脚本,添加数据库连接,并添加所有上传图像写入数据库文件。 如果您在再次打开上载页面时知道此脚本,脚本将显示旧的上载文件 但是我只需要显示我的属性id图像expample属性id='1'我怎么做 我的基础设施是这样的 数据库表名称:属性\u图像 图像\u id属性\u id顺序图像 1 image.jpg 2 1 2 image2.jpg 3 1 3 image3.jpg 4.2.1 image.jpg //------------此代码部分写入数据库中的所有图像------------------------------Php Blueimp jQuery文件上载-从数据库中列出图像,php,jquery,database,file-upload,blueimp,Php,Jquery,Database,File Upload,Blueimp,我需要帮助。请告诉我 我使用blueimpjquery文件上传脚本,添加数据库连接,并添加所有上传图像写入数据库文件。 如果您在再次打开上载页面时知道此脚本,脚本将显示旧的上载文件 但是我只需要显示我的属性id图像expample属性id='1'我怎么做 我的基础设施是这样的 数据库表名称:属性\u图像 图像\u id属性\u id顺序图像 1 image.jpg 2 1 2 image2.jpg 3 1 3 image3.jpg 4.2.1 image.jpg //------------此代
function query($query) {
$database = $this->options['database'];
$host = $this->options['host'];
$username = $this->options['username'];
$password = $this->options['password'];
$link = mysql_connect($host,$username,$password);
if (!$link) {
die(mysql_error());
}
$db_selected = mysql_select_db($database);
if (!$db_selected) {
die(mysql_error());
}
$result = mysql_query($query);
mysql_close($link);
return $result;
}
function add_img($whichimg)
{
$property_id= $_POST['property_id'];
$add_to_db = $this->query("INSERT INTO property_images (image,property_id) VALUES ('".$whichimg."','".$property_id."')") or die(mysql_error());
return $add_to_db;
}
function delete_img($delimg)
{
$delete_from_db = $this->query("DELETE FROM property_images WHERE image = '$delimg'") or die(mysql_error());
return $delete_from_db;
}
我认为这个脚本使用这些代码来列出图像,但是如何更改这些代码呢
protected function get_file_object($file_name) {
if ($this->is_valid_file_object($file_name)) {
$file = new stdClass();
$file->name = $file_name;
$file->size = $this->get_file_size(
$this->get_upload_path($file_name)
);
$file->url = $this->get_download_url($file->name);
foreach($this->options['image_versions'] as $version => $options) {
if (!empty($version)) {
if (is_file($this->get_upload_path($file_name, $version))) {
$file->{$version.'_url'} = $this->get_download_url(
$file->name,
$version
);
}
}
}
$this->set_file_delete_properties($file);
return $file;
}
return null;
}
该列表是通过
get\u file\u objects
方法(使用scandir
方法)完成的。用select查询替换scandir。然后,它迭代调用您提到的get\u file\u对象
方法的结果。
因此,
get\u file\u objects
是您要更改的方法。您给出的代码与选择图像无关,它不包含“选择”查询。查找具有“选择”查询属性的代码\u images是一个表名Look uploadhandler页面在这里请检查