Answers.Body: <p>Ok, I've worked it out.
  And it turns out that there <em>is</em> a location where CKEditor settings can be configured, namely at <code>civicrm/admin/ckeditor?preset=default</code>.
  (Through the GUI it's at "Administer" -> "System Settings" -> "Display Preferences", then click the "Configure CKEditor" button towards the bottom.)</p>
  
  <p>There are a few hitches on the way and perhaps this comes in useful for someone else down the track:</p>
  
  <ul>
  <li>the image directory <em>must</em> be called <code>images</code> for the CiviMail browser to work with it;</li>
  <li>the image upload directory setting in CiviCRM needs to point to the parent directory of that <code>images</code> dir; in my case it is <code>[cms.root]/sites/default/files/</code>;</li>
  <li>the setting to override in the CKEditor settings is <code>ImageUploadURL</code>, which also needs to point at the parent dir of <code>images</code>. A local path works - I used <code>/sites/default/files</code>.</li>
  <li><p>turns out that that alone didn't do the trick (I could browse the correct directory, but the browser would then return the wrong URL string); I also needed to override the setting in <code>civicrm.settings.php</code> like so (look for <code>$civicrm_setting</code> to find the examples):</p>
  
  <p>$civicrm_setting['URL Preferences']['imageUploadURL'] = '/sites/default/files';</p></li>
  </ul>
  
  <p>And that's it!</p>
  
  <p>Now for this naming requirement.</p>
  
  <p>In my case, we have been keeping all our images organised in a directory called <code>uploads</code>, and the image browser clearly had a problem with symbolic links. So what I did is</p>
  
  <pre><code>mv uploads images
  ln -s images uploads
  </code></pre>
  
  <p>Aka rename <code>uploads</code> to <code>images</code>, then create a symbolic link named <code>uploads</code>. Then reconfigure IMCE in Drupal to now use the <code>images</code> folder. (It seemed to keep working just fine with the symbolic link, but we want to keep things clean.)</p>
  
  <p>NB: In my case, the site is hosted on a cPanel with no ssh access, so I did the renaming through the GUI and then created a cronjob to run the second command (here at 19:45h, and don't forget to delete it again) like so:</p>
  
  <pre><code>45  19  *   *   *   ln -s images /path/to/drupal/sites/default/files/uploads
  </code></pre>
  
  <p>As a result, all images now live in <code>$drupaldir/sites/default/files/images</code> and both, IMCE in Drupal, and kceditor/ckeditor/whateveritis in CiviMail, now work with it, referencing the same files. Yay!</p>
  
  <p>Meanwhile, Apache seems happy to resolve across the symlink, hence all existing URLs keep working, though it'd be nice to clean them up over time.</p>
  
  <p>(Not a straight-forward search/replace through the database, unfortunately, as the two strings have different lengths. If they were the same length, that'd be simple.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-26T18:52:49.913Z
Answers.Text: good sleuthing. when you get more Reputation you should be able to Accept (green tick) your own answer
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-27T03:00:05.620Z
Answers.Text: Thanks @petednz-fuzion 
  The message I got when trying to accept my answer was that I'd need to wait 24 hours before I can do that.
Answers.UserDisplayName: rjoz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-26T08:59:54.437Z
Answers.LastActivityDate: 2018-11-27T03:03:18.983Z
Answers.LastEditDate: 2018-11-27T03:03:18.983Z
Answers.UserDisplayName: rjoz
Body: <p>G'day,</p>
  
  <p>Using CiviCRM 5.7.2 with Drupal 7.61, when editing a newsletter in CiviMail, the image browser always points me to</p>
  
  <pre><code>$drupaldir/sites/all/modules/civicrm/persist/contribute/images/
  </code></pre>
  
  <p>no matter what I configure as the directory path for "Image Directory" at</p>
  
  <pre><code>civicrm/admin/setting/path?reset=1
  </code></pre>
  
  <p>I've tried relative path ([cms.root]/sites/default/files/uploads), absolute path, and absolute path via settings override in civicrm.settings.php; all to no avail.</p>
  
  <p>[added to clarify in response to @Chris Burgess' comment]:
  The setting does stick, as in it shows up as entered in the form after a reload; and when I tried settings override via civicrm.settings.php, that setting showed up instead and made the form field uneditable. Still, whatever shows up there does not seem to have any impact on where the image browser takes me.</p>
  
  <p>I double- and triple-checked permissions and they are fine; we're also using the same directory with ckEditor and IMCE in Drupal with no problems.</p>
  
  <p>Not sure if I'm missing something, but isn't that the correct setting for what I want to do?
  Either way, is there a way to point the image browser to our general image path in the drupal files directory?</p>
  
  <p>Many thanks in advance for any advice!</p>
  
  <p>Update:
  The image browser window shows the following URL:</p>
  
  <pre><code>&lt;mywebsite&gt;/sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&amp;type=images&amp;CKEditor=crmUild_1&amp;CKEditorFuncNum=0&amp;langCode=en-au
  </code></pre>
  
  <p>so I poked around a bit in the <code>kcfinder</code> directory. There's a <code>config.php</code>, but it appears that the settings in there are also ignored.</p>
  
  <p>So I took more desperate measures:</p>
  
  <pre><code>cd $drupaldir/sites/all/modules/civicrm/persist/contribute
  mv images images.HOLD; ln -s ../../../../../default/files/uploads images
  </code></pre>
  
  <p>Now it shows me the correct directory (though with the wrong name), but whatever I try to do, I get a "warning" dialog stating "unknown error".
  Well, was worth a try.</p>
  
  <p>Anything else I could try to get this to work?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T05:32:04.593Z
Comments.Text: When you set the value in the CiviCRM UI, does the change get saved so that you see the changed value when reloading the admin form you set the value in? If not, it's possible that your site has a settings override in place - see [this link for docs on settings overrides](https://docs.civicrm.org/sysadmin/en/latest/customize/settings/)
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T05:35:57.787Z
Comments.Text: Hi Chris, thanks for the suggestion and yes, the setting does stick. I've also tried settings override and had it show up alright on the configuration page. I'll amend my question, thanks again.
Comments.UserDisplayName: rjoz
Tags: <civimail><ckeditor><images><directory>
Title: image directory path seems to be ignored in CiviMail editor
ThreadText: # image directory path seems to be ignored in CiviMail editor
  
  (Asked by: username_0 on 2018-11-25)
  
  G'day,
  Using CiviCRM 5.7.2 with Drupal 7.61, when editing a newsletter in CiviMail, the image browser always points me to
  $drupaldir/sites/all/modules/civicrm/persist/contribute/images/
  
  no matter what I configure as the directory path for "Image Directory" at
  civicrm/admin/setting/path?reset=1
  
  I've tried relative path ([cms.root]/sites/default/files/uploads), absolute path, and absolute path via settings override in civicrm.settings.php; all to no avail.
  [added to clarify in response to @username_1' comment]:
  The setting does stick, as in it shows up as entered in the form after a reload; and when I tried settings override via civicrm.settings.php, that setting showed up instead and made the form field uneditable. Still, whatever shows up there does not seem to have any impact on where the image browser takes me.
  I double- and triple-checked permissions and they are fine; we're also using the same directory with ckEditor and IMCE in Drupal with no problems.
  Not sure if I'm missing something, but isn't that the correct setting for what I want to do?
  Either way, is there a way to point the image browser to our general image path in the drupal files directory?
  Many thanks in advance for any advice!
  Update:
  The image browser window shows the following URL:
  /sites/all/modules/civicrm/packages/kcfinder/browse.php?cms=civicrm&type=images&CKEditor=crmUild_1&CKEditorFuncNum=0&langCode=en-au
  
  so I poked around a bit in the kcfinder directory. There's a config.php, but it appears that the settings in there are also ignored.
  So I took more desperate measures:
  cd $drupaldir/sites/all/modules/civicrm/persist/contribute
  mv images images.HOLD; ln -s ../../../../../default/files/uploads images
  
  Now it shows me the correct directory (though with the wrong name), but whatever I try to do, I get a "warning" dialog stating "unknown error".
  Well, was worth a try.
  Anything else I could try to get this to work?
  
  **Tags:** civimail, ckeditor, images, directory
  
  > **Comments:**
  > **username_1**: When you set the value in the CiviCRM UI, does the change get saved so that you see the changed value when reloading the admin form you set the value in? If not, it's possible that your site has a settings override in place - see [this link for docs on settings overrides](https://docs.civicrm.org/sysadmin/en/latest/customize/settings/)  
  > **username_0**: Hi Chris, thanks for the suggestion and yes, the setting does stick. I've also tried settings override and had it show up alright on the configuration page. I'll amend my question, thanks again.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-11-26. Score: 3 | Accepted answer
  
  Ok, I've worked it out.
  And it turns out that there is a location where CKEditor settings can be configured, namely at civicrm/admin/ckeditor?preset=default.
  (Through the GUI it's at "Administer" -> "System Settings" -> "Display Preferences", then click the "Configure CKEditor" button towards the bottom.)
  There are a few hitches on the way and perhaps this comes in useful for someone else down the track:
  
  the image directory must be called images for the CiviMail browser to work with it;
  the image upload directory setting in CiviCRM needs to point to the parent directory of that images dir; in my case it is [cms.root]/sites/default/files/;
  the setting to override in the CKEditor settings is ImageUploadURL, which also needs to point at the parent dir of images. A local path works - I used /sites/default/files.
  turns out that that alone didn't do the trick (I could browse the correct directory, but the browser would then return the wrong URL string); I also needed to override the setting in civicrm.settings.php like so (look for $civicrm_setting to find the examples):
  $civicrm_setting['URL Preferences']['imageUploadURL'] = '/sites/default/files';
  
  And that's it!
  Now for this naming requirement.
  In my case, we have been keeping all our images organised in a directory called uploads, and the image browser clearly had a problem with symbolic links. So what I did is
  mv uploads images
  ln -s images uploads
  
  Aka rename uploads to images, then create a symbolic link named uploads. Then reconfigure IMCE in Drupal to now use the images folder. (It seemed to keep working just fine with the symbolic link, but we want to keep things clean.)
  NB: In my case, the site is hosted on a cPanel with no ssh access, so I did the renaming through the GUI and then created a cronjob to run the second command (here at 19:45h, and don't forget to delete it again) like so:
  45  19  *   *   *   ln -s images /path/to/drupal/sites/default/files/uploads
  
  As a result, all images now live in $drupaldir/sites/default/files/images and both, IMCE in Drupal, and kceditor/ckeditor/whateveritis in CiviMail, now work with it, referencing the same files. Yay!
  Meanwhile, Apache seems happy to resolve across the symlink, hence all existing URLs keep working, though it'd be nice to clean them up over time.
  (Not a straight-forward search/replace through the database, unfortunately, as the two strings have different lengths. If they were the same length, that'd be simple.)
  
  > **Comments:**
  > **username_2**: good sleuthing. when you get more Reputation you should be able to Accept (green tick) your own answer  
  > **username_0**: Thanks @petednz-fuzion  The message I got when trying to accept my answer was that I'd need to wait 24 hours before I can do that.  
  
  ---
  
  