CrazyElk Posted December 23, 2020 Share Posted December 23, 2020 Howdy, I note there is no provision to host avatar image files locally, apart from the answer "to save server space" is there any valid reason? Is there a module available to perform this task or is anyone contemplating writing one? Cheers. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 23, 2020 Share Posted December 23, 2020 It takes a little bit more effort for safety of uploading images, but certainly possible to do. I wrote one for MCCodes that could be converted but I don't think it's still on here now. - if I can find it I will pop it up. 🙂 Quote Link to comment Share on other sites More sharing options...
Dayo Posted December 23, 2020 Share Posted December 23, 2020 I'll look into this Quote Link to comment Share on other sites More sharing options...
CrazyElk Posted December 24, 2020 Author Share Posted December 24, 2020 2 hours ago, Djkanna said: It takes a little bit more effort for safety of uploading images, but certainly possible to do. I wrote one for MCCodes that could be converted but I don't think it's still on here now. - if I can find it I will pop it up. 🙂 Your a pal ... cheers. 1 hour ago, Dayo said: I'll look into this Thank you, the framework for uploading appears to exist relative to adding modules and themes, occurs to me it may be a relatively simple task to port that to locally storing avatars ... cheers. Quote Link to comment Share on other sites More sharing options...
CrazyElk Posted January 26, 2021 Author Share Posted January 26, 2021 (edited) @Dayo has now implemented this into my game, great job thank you. 😀 Edited January 26, 2021 by CrazyElk 2 Quote Link to comment Share on other sites More sharing options...
Djkanna Posted January 28, 2021 Share Posted January 28, 2021 On 1/26/2021 at 7:08 AM, CrazyElk said: @Dayo has now implemented this into my game, great job thank you. 😀 Glad you got it sorted... and sorry I totally forgot about it ( someone needs to constantly poke me for me to do things next time 🙂 ) 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted January 28, 2021 Share Posted January 28, 2021 Some simple checking if allowed file type is attempting to be uploaded then check if file type is valid is basically all that needs to b3 done. 1 Quote Link to comment Share on other sites More sharing options...
URBANZ Posted January 28, 2021 Share Posted January 28, 2021 personally in my game i just use for the output to save on database space and get rid of the whole FastImage class also. public function getProfilePicture() { $pic = glob("images/avatars/" . $this->info->U_id . ".{jpg,jpeg,png,gif}", GLOB_BRACE); $pic = ($pic ? $pic[0] : "images/avatars/default.png"); return $pic; } for the upload i check all file extensions and also i stop any execution in the images directory if this system was to ever fail 1 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted January 29, 2021 Share Posted January 29, 2021 13 hours ago, URBANZ said: personally in my game i just use for the output to save on database space and get rid of the whole FastImage class also. public function getProfilePicture() { $pic = glob("images/avatars/" . $this->info->U_id . ".{jpg,jpeg,png,gif}", GLOB_BRACE); $pic = ($pic ? $pic[0] : "images/avatars/default.png"); return $pic; } public function getProfilePicture() { $pic = glob("images/avatars/" . $this->info->U_id . ".{jpg,jpeg,png,gif}", GLOB_BRACE); $pic = ($pic ? $pic[0] : "images/avatars/default.png"); return $pic; } for the upload i check all file extensions and also i stop any execution in the images directory if this system was to ever fail I can throw a little PHP code into a .jpg and cURL it to execute whatever I want on your server. Checking the extension alone is not enough Quote Link to comment Share on other sites More sharing options...
URBANZ Posted January 29, 2021 Share Posted January 29, 2021 (edited) Quote for the upload i check all file extensions and also i stop any execution in the images directory if this system was to ever fail this is very true MTG this is why i do extra checks that is just 1 check for file exensions then stop executions in certain directories. but i know what you mean if people fail to do this it is easy to execute code Edited January 29, 2021 by URBANZ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.