Move image extensions, MIME types, and size limit into a dedicated constants module. Extract JSON-from-text parsing into a pure utility function for reuse across the codebase.