Refactored image api to use one route instead of two that were almost identical