blueimp/jQuery-File-Upload — Issue #1003: PHP MySQL foreach file
Author: sickaaron
Created: 2012-02-10 08:45:32+00:00
State: open

Hey.

So my administration software as a products and gallery sections, both using MySQL for the thumbtail and the main bigger image, this is so that on the website it will load fast and i wont have to install any additional image resize class etc. Anyways to the point.. i want to add this somewhere:

mysql_query("INSERT INTO `$sys_db_name` (`id`,`$item_row_id`,`$item_row_thumb`,`$item_row_main`) VALUES ('', '$item_id', '$thumb_uploaded_file' ,'$main_uploaded_file')");

So that the thumb goes into the 3rd value and the main image goes in to the 4th value. I do have different folders for these too.. like:

function __construct($options=null) {
$this->options = array(
'script_url' => $this->getFullUrl().'/',
'upload_dir' => $sys_path.'/big/',
'upload_url' => $this->getFullUrl().$sys_path.'/big/',
'param_name' => 'big',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
'min_file_size' => 1,
'accept_file_types' => '/.+$/i',
'max_number_of_files' => null,
// Set the following option to false to enable non-multipart uploads:
'discard_aborted_uploads' => true,
// Set to true to rotate images based on EXIF meta data, if available:
'orient_image' => false,
'image_versions' => array(
// Uncomment the following version to restrict the size of
// uploaded images. You can also add additional versions with
// their own upload directories:
'thumbnail' => array(
'upload_dir' => $sys_path.'/thumb/',
'upload_url' => $this->getFullUrl().$sys_path.'/thumb/',
'max_width' => 200,
'max_height' => 200
)
)
);
if ($options) {
$this->options = array_replace_recursive($this->options, $options);
}
}

and in the index i have defined the variables like so:

if($_GET['type'] == 'gallery') {
$sys_path = $files.'/'.$hash.'/gallery';
$sys_db_name = 'Gallery_images';
$item_id = $_GET['id'];
$item_row_id = 'Gallery_id';
$item_row_thumb = 'Gallery_Image_Thumb';
$item_row_main = 'Gallery_Image_Big';
} elseif($_GET['type'] == 'products') {
$sys_path = $files.'/'.$hash.'/products';
$sys_db_name = 'Products_images';
$item_id = $_GET['id'];
$item_row_id = 'Product_id';
$item_row_thumb = 'Product_Image_Thumb';
$item_row_main = 'Product_Image_Big';
}

and of course the post url is the following:
/core/index.php?type=gallery&id=1 or /core/index.php?type=products&id=1

So i not sure if i should put the mysql in the upload.class.php or the index.php -- to this note i have read other posts, but they are only handling the 1 image, i want to do both :)

1 other small question...
$this->options = array(
'script_url' => $this->getFullUrl().'/',
'upload_dir' => $sys_path.'/big/',
'upload_url' => $this->getFullUrl().$sys_path.'/big/',
'param_name' => 'big',

Does that upload the big image... or would i need to add another array like the thumbtail... for large so to speak, there was a large commented out, but i was not sure if this would upload twice or 3 times.

Thanks for any help, i know its alot!