Fixed wrong extension determination of image files.
Added PDate class to handle doctrine Datetimes.