I have a 2.4 Ss site here that's been around for a while. The assets/Uploads directory is a bit of a mess, and the owner would like to organize these images logically now.
So I have written a script that loops through all images in the assets/Uploads directory, gets an id from the File table, and checks for any usage of that id in some pre-defined image fields for a set of pages.
The script then copies the original image to it's new logical location, updates the File table (just the Filename field) with the new path, and deletes the original image.
Note: There are hundreds of images.
All of this appears to be working on the surface. Copying is correct, the update to the table is correct. However when I refresh a page containing a (resized) image I know has been moved, the page is still using the same Uploads/_resampled cached item rather than a new cache image in the Uploads/new_directory/_resampled directory.
I have manually deleted the cache item, but the system simply recreates it on refresh.
1. Am I wrong in assume that using the new folder's _resampled directory would be the expected behavior? Images that are uploaded through the CMS to that directory certainly do.
2. It just dawned on me that I did not update the "LastEdited" field in the Files table when I update the path. I did this manually to no avail however. Should this be updated when the path changes?
3. Is there a better way (other than the DnD interface in Files and Images) to manually move assets in this fashion.
Cheers for any help