Make WordPress Core

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)

#1 @joemcgill
10 years ago

  • Owner set to joemcgill
  • Status new → reviewing

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 the srcset attributes are also being rewritten. If you're handling this yourself, you can make use of the wp_calculate_image_srcset filter to convert all of the files in the srcset attribute to point to the files on your CDN.

#2 @joemcgill
10 years ago

  • Milestone Awaiting Review
  • Resolution → worksforme
  • Status reviewing → closed

Closing since I believe this will need to be handled by the CDN plugin, as described above.

Note: See TracTickets for help on using tickets.