Query database for metadata only on resize

Update for https://github.com/syamilmj/Aqua-Resizer/pull/49
Now the script makes a database query only when the image is resized.