すべての画像名をコンマで区切る必要があります。Bcoz DB にカンマ区切り形式で名前を挿入する必要があります。
handle_file_upload() 関数でこれをやろうとしています
$arrOfImgs = array($file->name); $comma_separated = implode(",", $arrOfImgs);
そしてこれを渡す
$file->upload_to_db = $this->add_img($comma_separated);
しかし、失敗します。
助けてください..
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
$index = null, $content_range = null) {
$file = new stdClass();
$file->name = $this->trim_file_name($name, $type, $index, $content_range);
$arrOfImgs = array($file->name);
$comma_separated = implode(",", $arrOfImgs);
$file->size = $this->fix_integer_overflow(intval($size));
$file->type = $type;
if ($this->validate($uploaded_file, $file, $error, $index)) {
$this->handle_form_data($file, $index);
$upload_dir = $this->get_upload_path();
if (!is_dir($upload_dir)) {
mkdir($upload_dir, $this->options['mkdir_mode'], true);
}
$file_path = $this->get_upload_path($file->name);
$append_file = $content_range && is_file($file_path) &&
$file->size > $this->get_file_size($file_path);
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
// multipart/formdata uploads (POST method uploads)
if ($append_file) {
file_put_contents(
$file_path,
fopen($uploaded_file, 'r'),
FILE_APPEND
);
} else {
move_uploaded_file($uploaded_file, $file_path);
}
} else {
// Non-multipart uploads (PUT method support)
file_put_contents(
$file_path,
fopen('php://input', 'r'),
$append_file ? FILE_APPEND : 0
);
}
$file_size = $this->get_file_size($file_path, $append_file);
if ($file_size === $file->size) {
if ($this->options['orient_image']) {
$this->orient_image($file_path);
}
$file->url = $this->get_download_url($file->name);
foreach($this->options['image_versions'] as $version => $options) {
if ($this->create_scaled_image($file->name, $version, $options)) {
if (!empty($version)) {
$file->{$version.'_url'} = $this->get_download_url(
$file->name,
$version
);
} else {
$file_size = $this->get_file_size($file_path, true);
}
}
}
} else if (!$content_range && $this->options['discard_aborted_uploads']) {
unlink($file_path);
$file->error = 'abort';
}
$file->upload_to_db = $this->add_img($comma_separated);
$file->size = $file_size;
$this->set_file_delete_properties($file);
}
return $file;
}