mansj / enable-media-replace

***DEVELOPMENT DISCONTINUED*** Enable Media Replace, a WordPress plugin to make it possible to replace uploaded media files in a simple way.
GNU General Public License v2.0
28 stars 27 forks source link

When doing a search/replace with new file name, also update URLs using image sizes. #24

Closed ianmjones closed 7 years ago

ianmjones commented 7 years ago

Resolves #10

Currently links and img tag src attributes referencing sized images (thumbnails) are not replaced during a search and replace upload. This could potentially leave a lot of content with broken links and images.

This PR aims to fix this by replacing each old size URL with the new file's version of that specific size, falling back to the full URL if the size does not exist for the new file. The fallback should be enough in current versions of WordPress as width and height attributes are often used in img tags and srcset is usually generated on render to override them anyway.

mansj commented 7 years ago

Thanks, I'll take a look at this shortly!

ianmjones commented 7 years ago

Hey @mansj, thanks for reviewing this PR. If you have any concerns / suggestions, please let me know.