LPS-50330 Use JDBC to retrieve original image content from DB with the legacy logic

Hi @sergiogonzalez 

I made the necessary modifications we discussed for:https://github.com/sergiogonzalez/liferay-portal/pull/1700

Further more, I've tested it with:

```
image.hook.impl=com.liferay.portal.image.DatabaseHook
image.hook.impl=com.liferay.portal.image.DLHook
image.hook.impl=com.liferay.portal.image.FileSystemHook
```

It seems it's fine.

Regards,
Vilmos