The theme function theme_image_srcset() uses file_create_url() for the image URLs that it creates which causes a 403 Access Denied error when trying to view those images. This is because image derivatives require a token since Drupal 7.20: https://www.drupal.org/drupal-7.20-release-notes

Comments

Daniel Korte created an issue. See original summary.

daniel korte’s picture

Status: Active » Needs review
StatusFileSize
new2.83 KB

Here is a patch that fixes this but changes exactly what theme_image_srcset() expects. Instead of a srcset of URIs the style names are passed in instead.

daniel korte’s picture

I realized that it would be more flexible if the theme_image_srcset() theme function kept the "uri" key functionality intact for two reasons:

  • So as not to break any custom themes that rely on using the "uri" key
  • So direct URLs to external images can be passed to this function

Attached is the new patch.

lesleyfernandes’s picture

Status: Needs review » Closed (outdated)

I am closing all very old tickets that have not received comments for a long time. If someone still faces these issues or thinks they are relevant, please reopen it. Feel free to contribute with more info or a patch.