Great mess with the resizing of users' thumbs

    • 75 posts
    July 11, 2018 12:50 PM EDT

    Not sure that this qualify exactly as a bug but it's definitely a source of troubles and definitely needs work - so here it is:

    The trouble is with the code that resizes the users' images and creates the whole set of thumbnails of different sizes.

    This code SHOULD BE IN A MODEL - WHERE IT BELONGS!

    Instead it is all inside controllers (bad bad fat fat controllers!!!) Such placement makes the code virtually not reusable at all - in fact it is DUPLICATED in a number  of different places:

    • signupController of module user
    • plugin photo/signup of module user
    • coverphotoController of module user
    • possibly more places that I haven't discovered yet???

    The code is duplicated BUT always with slight differences: the biggest being that for instance a same thumb.profile image will be sized at 320x640 in one place and at 400x400 in another place.

    On top of this, some places looks into the general settings to find the sizes - some other places have the sizes HARD CODED!!! The one places that look at the general settings, look at settings that are named like: 'main.photo.height', 'normal.photo.height', etc.

    But in the general settings table, the settings that are aimed at images are named following a completely different synax, like: 'core.thumbnails.profile.height' etc. Hence, unless I miss some magic method along the way, I don't think the settings are ever found in any case.

    In any case, these settings don't seem to be reachable from the admin...

    Hope this little analysis may be useful and prompt an improvement of this part fo the code

     

    • Moderator
    • 6923 posts
    July 12, 2018 6:21 AM EDT

    This one is difficult. It is not following our bug reporting requirements posted in the stickied post and has a combination of feature request and bug report. I initially moved to feature request because 95% of it is feature request. However, it contains a bug, though not following the guidelines for posting.

    I'll keep it here for the bug but please note that since the feature request isn't actually requested per the guidelines in the feature request area, we can't consider that.

    On top of this, some places looks into the general settings to find the sizes - some other places have the sizes HARD CODED!!! The one places that look at the general settings, look at settings that are named like: 'main.photo.height', 'normal.photo.height', etc.

    But in the general settings table, the settings that are aimed at images are named following a completely different synax, like: 'core.thumbnails.profile.height' etc. Hence, unless I miss some magic method along the way, I don't think the settings are ever found in any case.

    In any case, these settings don't seem to be reachable from the admin..

    We'll look at the issue of the general settings not matching what is coded. However, as this is not formatted well, it's going to take a long time for us to check this issue. Though I can use sublime to find the two settings you mentioned. I cannot use sublime to find the "etc" stuff lol. It would be best to follow our stickied guidelines for posting for better results. 

    • 75 posts
    July 20, 2018 9:40 AM EDT

    Apologies - was just trying to be helpful, really, but I'm very much "overloaded" with work :-)

    There's really no request for new features - just the present implementation of the existing features is very keen to causing problems. Should be cleaned as soon as possible. The settings that I mentioned are, if i recall correctly, in the editController of the User module.

    • Moderator
    • 6923 posts
    July 20, 2018 9:51 AM EDT

    Thank you for posting.