With a configuration of several domains and languages, I found that the thumbnails or other style images used in Views were not created. I found that switching off Domain Locale, the images were created. I found that it was related to URLs of images having the character "?". The domains which were affected were those who didn't have one language (Spanish) which was set to the original language when installing Drupal. The configuration which exhibits the problem is:
- Domain with different languages to the default main configuration site (before Domain Access and Domain Locale installation).
- Default language in (1) different from English.
- Clean URLs active.
- Views and Views Domain active
- Affected images: those which have a Style Image and thus are created on-the-fly and not submission of node create form.
The behaviour can be replicated (and is related to the problem above) by visiting:
If the domain shows the login screen, there is no problem. If it is redirected to homepage or elsewhere, the domain is affected by a possible bug in Domain Locale.
Comments
Comment #2
Drupipi commentedI have apparently solved this issue by making the following exception: in the init method, I make an exception to the drupal_goto if the URL of the HTTP resource contains ".jpg", ".png". in the appropriate position (end of URL before any ?, #, &). It is not elegant, but works perfectly with no apparent side effects, and still retains the functionality of redirection when you try to visit a node in the default language, and the language is not set as one of the allowed ones for that specific domain.
Comment #3
michiellucas commentedI to had this problem, fixed it with a check on the default file path. Created patch
Comment #4
Drupipi commentedmichiellucas, in my version of the module, the lines read different to what you put as - (delete line). I already have
and also already have
with $url_suffix being $language_default->prefix, which is equivalent to your code, and functionally identical.
And still have the problem, with the only solution applying the drupal_goto exception for images.
Comment #5
mac_weber commentedDo this bug happen if there is a language prefix for all languages?
My recommendation is to ALWAYS use language prefix on ALL LANGUAGES, this avoids lots of bugs.
Comment #6
Drupipi commentedYes, I have activated prefixes (in reality, suffixes, i.e. www.example.com/en, www.example.com/ru, etc.) for all languages. I think the problem lies in Spanish being the default language for all the sites (core configuration previous to Domain Access and Domain locale installation). Somehow this makes that if a domain is not assigned that language, the bug, because it seems a bug, makes that the image cannot be created. What I am not sure if it is a bug of the core (image thumbnail creation) or this module or some incompatibility of both. I solved by using the lines in my reply, which is, of course, a temporary and very limited solution. The problem is serious: I could not have thumbnails for my views in other languages in domains not having Spanish assigned in Domain Locale !!!
Comment #7
mac_weber commented@Drupipi thank you for the patch. I think we need more people to test this patch before merging.
Things I'm afraid of:
- The first versions of D7 Domain Locale did not lock the options at the page
admin/structure/domain/view/language. All language settings must be done at/admin/structure/domain/view/[domain_id]/language. I'm afraid the first people which may had modified these options at that time are the ones facing this issue.- I'm not sure how this patch will affect sites which are already working fine. Maybe it creates double language path prefix?
- Probably we should write an update hook to make sure all languages are enabled under the hood, as need. This already done today at the installation. http://cgit.drupalcode.org/domain_locale/tree/domain_locale.install?id=f...
Try removing the changes you had done and running code to update the database to enable all languages, as done at the hook_install. Let me know if it works for you. If you write this code, please send a patch.
Comment #8
Drupipi commentedComment #9
Drupipi commented@Mac_Weber, I didn't send the patch, it was done by @michiellucas.
I tested the patch and didn't work for me. For me, it only works the temporary solution, which only corrects the problem with thumbnails. Any other problem related to this possible bug may be not corrected.
I will try the changes when I have some time.
Comment #10
kumkum29 commentedHello,
i have the same problem on several subdomains.
If I define only one language on these subdomains, the images aren't generated. If I choose all the available languages for these subdomains, the images are created.
I use the version 7.x-1.0-beta5.
Drupipi have you found a solution?
Thanks for your help. Perhaps have you a temporary solution to resolve this problem?
P.S. The code in the patch#3 seems to be the same in the 7.x-1.0-beta5 version...
Comment #11
Drupipi commentedWell, kumkum29, my solution was just a temporary one, crafted particularly to correct the specific problem, which seems exactly what happens to you, also.
So I changed the following file:
In sites/all/modules/domain_locale/domain_locale.module
in the function domain_locale_init() -- around line 242, depending on version
I add the following code, after the line that reads: $url_suffix = ''; }
CAUTION: Paste the code AFTER the closing parenthesis. Preceding lines included for clarity:
The code will detect if the resource is an image (png, jpg, gif) and will redirect to the home page, in any other case. So for images, it will stay and then display the image.
If you have any problem, please contact me. Also, if you solve your problem with this code, please let me know. Thanks!!!
Comment #12
kumkum29 commentedHello Drupipi,
My problem is resolved with your code ! THANKS !!!!
Can we include this code in a future version of the module?
Thanks.
Comment #13
Drupipi commentedI am glad that it solved the problem.
As for the code, I think it would be better to fix the problem, this is more a patch than a real fix.
In any case, it should be "cleaned", something like this (not tested) or some more "pro" code:
Comment #14
kumkum29 commentedthere is a real problem with the enabled languages and your fix can be improved.
Can we have a reply by the maintainers for to know if this problem can be resolved in a future release?
Thanks.
Comment #15
mac_weber commented@kumkum29 I am maintainer of this module but currently I am only testing patches other developers send to check if they should be merged because I do not have any ongoing paid project with Domain Locale and right now I need to focus on paid projects.
If any person or any company is willing to hire my time to investigate this issue I would love to work on it. Otherwise, I will wait for someone else to send a definitive working solution to be tested and merged.
Changing the priority as per Priority levels of issues
Comment #16
stevendeleus commentedI ran into this problem and solved this by adding $_SERVER['REQUEST_URI'] to the redirect:
Comment #17
eloivaqueHi,
I thinks that the problem is the path is a path internal of drupal, and is created by hook_menu.
I created this patch and solved for me. I don't now is the best solution.
Comment #18
eloivaqueI created new patch, as the last patch doesn't work correcly. This new patch work perfect about image styles.
Comment #19
mac_weber commented@eloiv I really like your last patch, yet I haven't tested it manually myself.
I see a coding standard that could be improved if you follow these guidelines https://www.drupal.org/coding-standards#linelength
When you send the next patch please change the issue status to
needs review.I invite others to test this patch, and when you do so please post the list of modules you are using for translation because different module sets may have different outcomes (Entity Translation, i18n, etc).
Comment #20
hugronaphor commentedI can confirm that the patch on #18 fixes the thumbnail generation.
But I'm not sure about:
- You're checking the public file scheme. Can't it be a valid problem for private file directory as well?
- Why do we need to check the system_path? I think the problem it's just about accessing files on the server, while the system/* routes are defined in hoom_menu isn't it?