PHP function to efficiently read JPG file for size and optimization info