Change picture (crop) image source
Hi Team,
I managed to reference all user photo to external resource (s3), by putting userPhoto & userPhotoUrl function on a plugin (thanks to this https://open.vanillaforums.com/discussion/33180/i-need-to-reference-external-avatar-source-please-help). Profile avatar & discussion avatar are all referencing external however the change picture page (image to be crop & thumbnail view) are still referencing image source from local uploads folder not the external (s3) configured on userPhoto & userPhotoUrl function.
BTW, uploading using the image crop are going to external s3 bucket, that's part is done. The challenge is the image crop & thumbnail view referencing local "/uploads" folder which is being wipe out every time we deploy code, we persist images on s3 bucket.
I tried looking for profile/picture.php file to overwrite but no luck.
TIA
Comments
I have no solution, only two ideas. Try
Maybe that hook is too late and you need to change the photo as soon as the user information is provided. The this might be your only chance:
The "UserLoaded" event is fired everywhere in the profile controller. Therefore it is not very efficient to solve the problem that way.
profileController_userLoaded_handler is not firing, while profileController_render_before does. However changing $sender->User->Photo or $sender->User->PhotoUrl did not update the img source on the "Image to be crop" & "thumbnail view".
Tomorrow I'll try the preg_replace approach, soon as I can find picture.php from other themes.
Not fired? The line
$this->getUserInfo($userReference, $username, $userID, true);
calls the function which fires this event. Therefore I'm sure that it will be fired. Just skip the checks for ReqestMethod and that substr test.Sure changing the view will help? It is /applications/dashboard/views/profile/picture.php, but it has only this code where you like to see the changes.
The information comes from ProfileController->picture(). There I can find
So if Gdn_Upload::url is providig you with the correct address, all other things should work again. I know that based on a question from you I had a look at that function and there has been something with a prefixed namespace that was used here. But I do not remember the details...
Sorry @R_J but I still haven't figured out how do I modify the Gdn_Upload::url, that's why on my previous post I opted to manipulate the view by doing preg_replace + regex.
I get it to work by editing the profile/edit.php.
NO! If that is your solution, I would count it as a failure. You have edited a core file and now a) your plugin isn't deployable and b) your vanilla installation cannot be updated without hassles and c) this community might be unable to support you when you have issues.
Do you mind to show the changes you made here? Just to see if there is a way to make it work without changing any files.
Sorry for confusion, I did not edited the core profile/edit.php nor the profile/picture, I overwrite it by creating profile/picture.php on our custom theme.