Opened 9 years ago
Closed 8 years ago
#36899 closed defect (bug) (worksforme)
The srcset attribute (Responsive images) always returns the local URL of the file, not the URL on a CDN
Reported by: | kameraadpjotr | Owned by: | joemcgill |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.2 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
My site uses Rackspace Cloud Files as CDN for its images, so no images are stored locally.
All this works fine (the src attribute is set correctly), but when wordpress creates the srcset attribute for responsive images, it uses the local path (https://www.example.com/wp-content/uploads/2016/05/thumbnail.jpg) and not the CDN path (https://files.rackspace.com/file/thumbnail.jpg).
Expected result: it returns the CDN path and not the local path.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi @kameraadpjotr,
Thanks for the report. If you're using a plugin to rewrite the image
src
attributes to point to your CDN, then you may need to get in touch with the plugin author about making sure thesrcset
attributes are also being rewritten. If you're handling this yourself, you can make use of thewp_calculate_image_srcset
filter to convert all of the files in thesrcset
attribute to point to the files on your CDN.