2

これには助けが必要です。教えてください。

Blueimp jQuery File Upload スクリプトを使用し、データベース接続を追加し、すべてのアップロード画像を db ファイルに書き込みます。アップロードページを再度開いたときにこのスクリプトを知っている場合、スクリプトは古いアップロードファイルを表示します

しかし、property_id images example property_id='1'を表示するだけでよいのですが、どうすればそれを行うことができますか?

私のインフラストラクチャはこのようなものです

データベース テーブル名: property_images

image_id property_id 注文画像

1 1 1画像.jpg

2 1 2 画像2.jpg

3 1 3 画像3.jpg

4 2 1 画像.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;
}
4

1 に答える 1

2

リストは、get_file_objectsメソッド (メソッドを使用するscandir) を介して行われます。scandir を選択クエリに置き換えます。get_file_object次に、言及したメソッドを呼び出して結果を反復処理します。したがって、これget_file_objectsが変更したいメソッドです。

于 2012-12-17T11:30:43.077 に答える