Define Image Directory

Sitecake uploads images to the main /images dir. Where can we define / config a different unique image directory? I would like to keep SC uploads out of the main images directory.

Version is 2.4.7

I would prefer to have all images uploaded to web root: /simg/

I don’t have the current version of SC if other files docs etc. all along with images I’d prefer to web root: /scf/

This would be great if you could define these directories in the config.php

I modified …src/Sitecake/Site.php without a success.

if (preg_match($ignorePattern, $path[‘path’])
&& (((strpos($path[‘path’], ‘simg/’) == 0 || strpos($path[‘path’], ‘files/’) == 0)
&& preg_match(’/^.-sc[0-9a-f]{13}[^.]…+$/’, $path[‘path’]))
|| preg_match(’/^..(’ . implode(’|’, $extensions) . ‘)?$/’, $path[‘basename’]))) {
if (isset($this->metadata[‘files’][$path[‘path’]][0])) {
$files[$path[‘path’]] = $this->metadata[‘files’][$path[‘path’]];
$files[$path[‘path’]][0] = $path[‘timestamp’];
} else {
$files[$path[‘path’]] = [$path[‘timestamp’]];
}
}
}
} else {
if (((strpos($file[‘path’], ‘simg/’) == 0 || strpos($file[‘path’], ‘files/’) == 0)
&& preg_match(’/^.
-sc[0-9a-f]{13}[^.]…+$/’, $file[‘path’]))
|| preg_match(’/^.
.(’ . implode(’|’, $extensions) . ‘)?$/’, $file[‘basename’])) {
if (isset($this->metadata[‘files’][$file[‘path’]][0])) {
$files[$file[‘path’]] = $this->metadata[‘files’][$file[‘path’]];
$files[$file[‘path’]][0] = $file[‘timestamp’];
} else {
$files[$file[‘path’]] = [$file[‘timestamp’]];
}

I think this would benefit other SC users to keep files out of the main site sub content folders.

James

You can keep images in any dirs you want. But the images you upload with Sitecake will be uploaded to /images.

Hi Nik,
Edit: I noticed in the current version media directories can be configured :wink:

Also I noticed in the earlier version when you delete an image or doc from the page, they remain in the directories. Not sure if current version unlinks files when deleted.

Thanks again!
James