After we change any of those settings there's no way to "fix the paths" to the images.
To fix that we need to manually:
- change the paths on the database
- move the images on the filesystem to the new location
- clear the caches to clean all cached incorrect image paths
- if the new var dir doesn't start with "var" and/or the storage dir isn't "storage" we will have to change the rewrite rules as well
A script would be very useful, to check the var_dir and storage_dir, and update the values on the database, and move the images to the correct location, and clear the caches afterwards.
It would be also useful to have some documentation explaining what we need to do after we change var_dir and/or storage_dir.