valid_image_types = array(1,2); $this->images = array( 'std' => array( 'width' => 550, 'height' => 1200, 'quality' => 100, 'web_location' => '/images/emails/' ) ); foreach($this->images as $image_size=>$image_info) { // ----------------------------------------------------- // set path based on unix or windows $this->images[$image_size]['path'] = Config::$path_to_www; $this->images[$image_size]['path'] .= (Config::$location == 'remote') ? $this->images[$image_size]['web_location'] : str_replace('/', '\\', $this->images[$image_size]['web_location']); // ----------------------------------------------------- } } function _remove($id) { // remove image then delete record $this->remove_file(Database::ado_get_one("SELECT file FROM $this->db_table WHERE id='$id'")); Database::ado_execute_query("DELETE FROM $this->db_table WHERE id='$id' LIMIT 1"); } function remove_file($filename) { $image_files_to_delete = array(); foreach($this->images as $image_size=>$image_size_info) { $image_files_to_delete[$image_size] = $image_size_info['path'].$filename; } foreach($image_files_to_delete as $path_file) { Utilities::delete_file($path_file); } } function _insert($Form) { $ins = "INSERT INTO $this->db_table VALUES(NULL, '".$Form->get_field_value('file')."')"; return(Database::ado_execute_query($ins, "EmailImagesAdmin::_insert")); } function validate_input($id='') { global $DB, $U; //var_dump($this->input_data); exit(); foreach($this->fields as $fieldname=>$field) { if($field['required'] && trim($this->input_data[$fieldname]) == '') { $this->field_err[$fieldname] = 'required'; } } return (count($this->field_err) == 0) ? TRUE : FALSE; } function get_image_data($id) { return(Database::ado_get_row("SELECT * FROM $this->db_table WHERE id='$id'", "EmailImagesAdmin::get_image_data")); } } ?>