Hello guys.
I'm a total newbie in MODX world in a sense I used it somehow back then in Evo days, then abandoned it a for long time and just returned to its coziness again. I'd like to ask about its Manager and possibly fix one bug of it.
My environment: Windows developer machine, nginx 1.12.1 web server, latest Firefox and latest MODX 2.5.8-pl upgraded from 2.5.7-pl.
Anyway, as I installed it I set up Admin account and uploaded a user photo for it. It didn't show up. In admin settings, its path is relative: "assets/unchqua-100x100x256.png". My absolute path to MODX installation is J:\modx-2.5.8-pl\modx\ (two "modx" directories due to nginx url rewrite tricks).
The script which produces thumbnail images for this is connectors/system/phpthumb.php , all the processing starts here and goes deep into MODX classes.
Relevant classes are:
core/model/modx/processors/system/phpthumb.class.php
core/model/modx/sources/modmediasource.class.php
core/model/modx/sources/modfilemediasource.class.php
core/model/modx/moduser.class.php
Problem is that the URL which points to the picture uploaded is being made badly: somehow path "J:\modx-2.5.8-pl\modx\assets/unchqua-100x100x256.png" becomes "J:\modx-2.5.8-pl\modx\J:\modx-2.5.8-pl\modx\assets/unchqua-100x100x256.png", note two J:\... prefixes.
Also I've found settings for Media Sources - Filesystem, which has 2 relevant parameters: "basePath" (string) and "basePathRelative" (boolean). Playing with these settings I see different behaviour of phpthumb.php but basically there are two results: image's source either becomes "assets/unchqua-100x100x256.png" (and it's not working because this path is relative and the script can't tell relative to what) or "J:\modx-2.5.8-pl\modx\J:\modx-2.5.8-pl\modx\assets/unchqua-100x100x256.png" (double J:\ which is obviously wrong).
Finally I nailed it: in core/model/modx/moduser.class.php there are lines:
public function getProfilePhoto($width = 128, $height = 128) {
...
$path = $source->getBasePath($this->Profile->photo) . $this->Profile->photo;
...
}
If I change it to:
$path = $this->Profile->photo;
I get user picture right.
What I see is that this $path should stay relative here and only after that, going through modmediasource.class.php and its function prepareSrcForThumb($src), it becomes an absolute path which finally resolves to real path to local image.
Am I thinkging it all right? If so, is this a bug which should be reported?
MODx Revo 2.0.0 beta 4
Shameless MODx newbie
-
☆ A M B ☆
- 3,141 Posts
I've not checked your trail, but you do seem to have delved into it quite deeply! While the feature works for me (on a site not in a subdir), it does sound like you might be on to something.
If you could, please report the bug on github at
https://github.com/modxcms/revolution/issues
MODx Revo 2.0.0 beta 4
Shameless MODx newbie