Opened 10 years ago
Closed 10 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 |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Media | Version: | 4.5.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi @kameraadpjotr,
Thanks for the report. If you're using a plugin to rewrite the image
srcattributes to point to your CDN, then you may need to get in touch with the plugin author about making sure thesrcsetattributes are also being rewritten. If you're handling this yourself, you can make use of thewp_calculate_image_srcsetfilter to convert all of the files in thesrcsetattribute to point to the files on your CDN.