The community member is asking if there are any plans to automatically pull embedded images from the content markup and replace the URLs "on the fly". The primary use case is content-heavy sites where editors format the content in a visual editor and include contextual images. If the content is pulled from a CMS like WordPress via GraphQL, the images would be part of the content embed, which means no image compression or optimization would be applied.
In the comments, one community member suggests that pulling images at the same time as serving the page would be a huge performance issue, and it's up to the CMS to provide an optimized option. Another community member suggests a workaround where the images are pulled when they're served for the first time, and the original URL and asset URL are stored in a database. Then, a simple string search and replace can be used to replace the original URL with the asset URL to serve the localized, optimized image. This could also include a hash comparison to check for changes in the original image and a "purge localized images" button.
Related to the above: are there any plans on automatically pulling embedded images that are part of the markup (content embed) into assets and replacing URLs "on the fly" or is there a workaround for this?
My primary use case is content heavy sites. And the workflow that my editors are used to is that they format the content in a visual editor and include contextual images etc in it. If I use something like Tina (or pull post content from WordPress via GraphQL), this means those images would be part of the content embed within the Webstudio components. This would mean there's no image compression/optimization etc applied to those contextual images, which is of course not ideal.
It is a tricky one because content is loaded from cms on request from user. So pulling images at yhe same time would be a huge performance issue. It is up to cms to provide some optimized option.
Oh I didn't mean pull them at the same time as serving the page. But rather pull them when they're served for the first time, then store "original_url" and "asset_url" in your assets database for each file that has been pulled from an external source and then just run a simple string search and replace to replace the original_url with the asset_url to serve the localized image instead. Maybe along with a hash and periodically pull localized images from the original_url again and compare hashes in case an image file changed but uses the same URL/name. Or just a "purge localized images" button or something.. π