I just tried to change the theme from Mobile version 1.1.3 to Embed-Friendly version 3 but this didn't affect the result. The modified version still results in a whoops message, the unmodified gives the normal wysiwyg editor window.
I have found a solution to my problem! I had hoped that there would be a simple way of modifying the code (cf. my very first post above).
I thought that the random number name for the folder(s) could simply be replaced by the UserID. As I don't have any php programming skills at all I didn't know how to grasp the UserID to have inserted in the folder path. I found this function in the code suggested by @hgtonight:
$UserID = Gdn::Session()->UserID;
I inserted it and replaced: $Subdir = sprintf('%03d', mt_rand(0, 999)).'/';
with: $Subdir = $UserID . '/';
After that the code looks like this:
public function PostController_Imageupload_create()
{
try {
$UploadImage = new Gdn_UploadImage();
$TmpImage = $UploadImage->ValidateUpload('image_file');
$UserID = Gdn::Session()->UserID;
This is pretty much what @hgtonight suggested from start but something in the remainder of the code apparently was incompatible with my program installation. Anyway, changing these two lines was sufficient. Now all images from a user are placed in a separate folder with the name (= UserID number) of that member. And that was exactly what I was looking for!
Comments
I just tried to change the theme from Mobile version 1.1.3 to Embed-Friendly version 3 but this didn't affect the result. The modified version still results in a whoops message, the unmodified gives the normal wysiwyg editor window.
I have found a solution to my problem! I had hoped that there would be a simple way of modifying the code (cf. my very first post above).
I thought that the random number name for the folder(s) could simply be replaced by the UserID. As I don't have any php programming skills at all I didn't know how to grasp the UserID to have inserted in the folder path. I found this function in the code suggested by @hgtonight:
$UserID = Gdn::Session()->UserID;
I inserted it and replaced: $Subdir = sprintf('%03d', mt_rand(0, 999)).'/';
with: $Subdir = $UserID . '/';
After that the code looks like this:
public function PostController_Imageupload_create()
{
try {
$UploadImage = new Gdn_UploadImage();
$TmpImage = $UploadImage->ValidateUpload('image_file');
$UserID = Gdn::Session()->UserID;
This is pretty much what @hgtonight suggested from start but something in the remainder of the code apparently was incompatible with my program installation. Anyway, changing these two lines was sufficient. Now all images from a user are placed in a separate folder with the name (= UserID number) of that member. And that was exactly what I was looking for!
Thank you very much for your valuable advice!