I've run into some fairly fundamental bother with Media Sources, when using them to control where the manager of the site will upload files for specific purposes. Just what they're meant for, I'd have thought.
First, my site is running in a test subfolder on my domain, so the root URL for the whole site is:
domain.com/folder/subfolder/
As a result, MODx is prefixing TV generated URLs with that path, which is fine and to be expected. But when I upload a file into an image TV, for example, using a Media Source which is targeted at the assets/uploads/images/ subfolder, I run into problems with phpthumb because the URL for the item is different in the manager and the frontend. To make it work I've had to change the Media Source setting "baseUrlRelative" to "no", where the default "yes" seems to make more sense given that the URL is indeed relative.
More importantly, I'm now at the stage of putting in content for some of the pages, inserting images into the body and finding that now I've set the main 'File System' Media Source target to the assets/uploads/ subfolder to prevent the end-user uploading files into the root of the site, the path to the image is being truncated so as not to include the subfolders handled by the Media Source, and so I'm having to manually type "assets/uploads/" into the file path of the "Insert/Edit Image" popup.
At the moment, short of real understanding, I'm thinking I might have to change the File System media source back to the root of the site. Perhaps I shouldn't have changed it, but it doesn't seem to me that you can specific a Media Source for the page content editor on a per-template basis. Perhaps I'm wrong.
I worry I've not been able to fully and accurately recall the details of these issues. If it's clear enough perhaps someone can guess at what I'm after, which can't be at all unusual, and set me straight. Otherwise, please as for clarification and I'll see what I can do.
Essentially the behaviour of Media Sources and URL construction throughout the manager and frontend isn't happening as I'd expect, so I'd quite like to understand why, presuming that I haven't illuminated a real flaw in the logic.
No takers? Ok, I'll try to clarify. And shorten:
I've got the default 'File System' Media Source targeted at a subfolder within my site (assets/uploads/). The purpose is to simplify the browser for the site manager, and to prevent random files being uploaded to the root of the site.
When I try to insert an image into page content using the 'insert/edit image' button on the toolbar the browser correctly displays the target location, but when an image is selected, the path to the image that is inserted into the URL field when the image is selected doesn't include the path section used by the Media Source.
The resulting path will be something like "images/image.jpg" rather than "assets/uploads/images/image.jpg".
This can't be unusual, unless I've changed a setting I shouldn't have.
-
☆ A M B ☆
- 24,524 Posts
The most I've ever done with the default media source is to set it to the assets folder. As far as I understand, resources don't play well with media sources. User groups seem to incorporate them OK, and TVs are fine with them. But resources themselves don't pick up the Media Source part of the path.
Is that intentional, do you think? Also, if you've set the default one to point at the assets folder, did you not experience the same problem?
-
☆ A M B ☆
- 24,524 Posts
Hm. It was a while ago since I did that; I don't really remember exactly what I did it for. Now I always leave the default alone, create another one and assign it to the user groups for other manager users.
Ahhh, that's an interesing concept. So you can tell other user groups to have different default Media Sources?
In any case, surely this will result in the same problem. The issue seems to be that the resources, or perhaps the modx browser, isn't handling them correctly.
-
☆ A M B ☆
- 24,524 Posts
If I understand correctly (and here let me say that I by no means understand the user management system) it will work correctly by groups. It's just that the resource itself doesn't see the Media Source. The group should pass the media source path. Or something like that. I think. (going off to find BobRay's book)
So if I apply a Media Source to a group, and put the manager user account in that group, it'll override the default regardless of the 'resource' paying no attention? The resource will then get the correct paths enforced upon it by a 'higher power'?