how can i store an image in my postgresql database?
You need the Storage API module.

This allows you to set a field's upload destination to a custom storage class, one of which is database.

I've used this module for this exact purpose and worked well.