public function store_files($file_path, $file) { $is_image = getimagesize($file_path); $gallery_data = $this->options['gallery_data']; $base = new Base(); if ($is_image != 0 and $gallery_data['id'] != null) { $image_entity = new Image(); $image_entity->setName($file->name); $image_entity->setTitle($file->name); $image_entity->setPath($file_path); $base->audit_fields($image_entity, 'create'); $image_entity->save(); $gallery_image = new GalleryImage(); $gallery_image->setGalleryid($gallery_data['id']); $gallery_image->setImageid($image_entity->id); $base->audit_fields($gallery_image, 'create'); $gallery_image->save(); } else { $this->save_file_data($file->name, $file->type, $file->size, $file_path); } }