I am having the same problem with a static resource created directly from the Tree. If I manually add the ../home/pdf/ to the filename, then it works.
[ed. note: sottwell last edited this post 11 years, 6 months ago.]
-
- 5,888 Posts
I think the file-browser doesn't know, you are selecting the file for a static Resource or the static Resource doesn't know you have selected a file from file-browser by using a (custom) mediasource.
I think there isn't a setting or something where you can connect a static resource to a mediasource.
Or do I miss something?
Somewhere in the process the path from the media source is being dropped in the case of the PDF media source. When I select a file from within the web root, the entire path is in the form field. But when I select from the PDF media source only the filename is shown.
[ed. note: sottwell last edited this post 11 years, 6 months ago.]
Static Resources are not Media Source aware currently. This is completely dependent on the logic I mentioned earlier regarding components_path and resource_static_path Settings.
[ed. note: opengeek last edited this post 11 years, 6 months ago.]
-
- 5,888 Posts
isn't this the way how the filebrowser is working, when selecting a mediasource?
As soon as you select a file from filebrowser and you have selected a medisource, which points to another path than the web-root, it does return the filepath starting from mediasource-path.
The static Resource needs to know somehow, from which mediasouce you have selected the file.
It obviously is aware of the default Filesystem source, since if I use that one it does add the full path to the filename when selected.
I believe the File Browser only works with Static Resources if using the default media source by accident, i.e. this is a major bug in the integration of the File Browser with Static Resources. Trying to use other configurations likely will not work. But that said, and File Browser integration bugs aside, Static Resources themselves ONLY respect paths that are absolute or are relative to the Settings I am describing above.
So if I create a setting, static_resource_path, then I should be able to use a Media Source that uses the same path?
To an extent. I just added one for my Assets media source, which is set to my assets path using the relative path/url settings and was able to select a file properly from the Media Browser.
And the path setting is resource_static_path (and element_static_path), not static_resource_path.
Also, the resource_static_path defaults to the MODX_BASE_PATH, unlike element_static_path, which defaults to components_path or MODX_CORE_PATH . 'components/'.