So my client has been populating the site with content, but their images aren't optimised for the web.
Can I just download all the images, and then upload new versions to overwrite them ? Or are images linked more carefully to the DB?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI've never had any problems just replacing images.
If there are any images that have image styles applied then don't forget to clear the image styles caches/files so they get regenerated as well. You can do them all at once with Image style flush
tl;dr:
Should be fine so long as the filenames match.
Personally, I have never had a problem with this, but keep in mind that the data in the {file_managed}
will likely no longer be accurate.
In particular the {file_managed.filesize}
and the {file_managed.timestamp}
columns will be incorrect. This typically isn't a problem, but if you are using any of these fields (eg, in a view) they will be incorrect.
Any other module that implements hook_file_insert()
may also end up with stale data. I am unaware of any modules that do this, though.
I have long term plans to write a drush command and/or module to update {file_managed}
since I have clients who do this a lot. This may be a holiday project for me.
{file_managed}
table. So yeah, this should apply as well - be careful!
I found one issue with this, if the image is kept in the field, then image field will keep the old dimensions.
If the old dimensions are smaller such as width 100px height 100px
And imagestyle is width 600px height 600px
Even the replaced image is bigger than the imagestyle setting such as 1000px width/height, the image will be rendered in the old dimensions since the field will add the image attrbs from the field table.