Details
-
Type: Bug
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 4.7.16, 4.6.26
-
Fix Version/s: None
-
Component/s: Core CiviCRM
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:User and Admin Doc
-
Funding Source:Needs Funding
-
Verified?:No
Description
The contact image files are stored as a full url in the database (civicrm_contact.image_url), ie. https://<website_domain>/civicrm/contact/imagefile?photo=image.png.
This presents issues:
- when the website's URL is changed (ie. moved to a new domain, or moved from a subdomain to the www domain),
- in a CiviCRM multisite environment, the images uploaded in one domain are not visible in other domains unless the user also has access AND is logged in the domain where that picture was uploaded.
Note that 1 is not resolved by putting a redirect in place since the user needs to be logged in the domain hosting the images for the link to work. So for the redirect to work you would need to be logged in the website at the old URL as well as the current website.
I see 2 solutions to this issue:
- adopt the same methodology as for the civicrm_file table and just store the file name in the image_url field (so it really is image_file rather than image_url now). The rest of the URL is generated on display.
- replace the https://<website_domain>/ with the new [cms.root] token so the url is saved as [cms.root]/civicrm/contact/imagefile?photo=image.png in the database. Token expansion is done on display.
Note: tested on 4.7, even if the imageUploadUrl indicate [cms.root] the image_url is still saved in the database as the full URL. However changing to the [cms.root] syntax in the database corrected expands to the full URL on display. So solution 2 is halfway done.
Impact on both of the above solutions for multisite is that the image upload folder must be the same across sites so that one site can access images uploaded by another. We need to update the multisite documentation for that as nothing is specified now.
Note: are there use cases where the above is not desirable? Ie. one site could see images/files uploaded from the other sites that they are not supposed to see?
Attachments
Issue Links
- supplements
-
CRM-14646 new image display upgrade code not optimized, can result in error
- Done/Fixed