4

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?

3 Answers 3

5

I'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.

5

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.

1
  • I forgot all about the {file_managed} table. So yeah, this should apply as well - be careful!
    – Chapabu
    Oct 11, 2012 at 13:12
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.