In our environment we have a site installed at example.com and another one installed at example.com/internal.
drimage shows the wrong image (or none at all if a file with that id doesn't exist) at example.com/internal because it gets the image from /drimage/{width}/{height}/{fid}/{filename}, so it fetches an image from example.com.

I have created a patch which adds the subdirectory if the site if there is one.

If not, then feel free to set back to "needs review" and I'll include it.

Comments

emek created an issue. See original summary.

emek’s picture

Status: Active » Needs review
StatusFileSize
new9.31 KB

Here is the patch.

weseze’s picture

Issue summary: View changes
Status: Needs review » Needs work

Patch looks functionally good to me, but doesn't Drupal have a specific name for this part of the URL? I'd like to stick to Drupal-wording...

emek’s picture

I don't know, when looking at the documentation for multisites the only thing I find is subdirectory, https://www.drupal.org/docs/7/multisite-drupal/multi-site-in-subdirectories

weseze’s picture

The patch does not work with multilingual setup.
The resulting URL looks like /{LANGUAGE}drimage/... A slash seems to be missing. I would assume the same issue is present for subdirectories?

emek’s picture

StatusFileSize
new9.39 KB

I have updated the patch.

It seems as when the site is multilingual the $url variable doesn't end in a slash (which it did for my subdir sites). I have added a / between the parts in the js and added a check in the php code if the variable ends in a / and if it does it is removed.
It still works on my local sites. Hopefully it will work on your multilingual sites as well.

  • weseze committed aaa75ca on 8.x-1.x authored by emek
    Issue #3152008 by emek: Site installed in a subdirectory displays the...

  • weseze committed 34a05d4 on 2.x authored by emek
    Issue #3152008 by emek: Site installed in a subdirectory displays the...
weseze’s picture

Status: Needs work » Fixed

Looking good now. Committed and should become available in 2.0.1 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.