I have the ID of the image uploaded and I need to rename it using php.
(The reasons because I have to do it are difficult to explain and I think they are not even necessary for the purposes of this discussion)
I have 4 problems to solve:
- Rename the main file.jpg and the related file-WIDTH-HEIGHT.jpg files - simply solved with rename php function
- Re-assign the new filename to the attachment so that WordPress knows the new filename (can I do it updating the 'guid' column of the attachment in the db?)
- Manage the related files (file-WIDTH-HEIGHT.jpg). Where are stored the relationship between the main file and the related ones?
- Update all these on posts/widget/ecc. (can I do it with a 'simple' string replace procedure on the sql file exported from the database?)
As you can see I have a bit of confusion in my mind because I don't know completely the way used by WordPress to manage the attachments from a system/db point of view.
Thanks for any suggestions.