Image Preview Bug Fix

Fixed a bug where image preview was being called even though the file
was yet to be physically created.