Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
requests-topic
Generate user avatar thumbnails (instead of loading a large image just for displaying a small avatar)
Avatar
adesigns development
Rookie
Free Members
Offline
Sep 1, 2012 - 10:10 am

Hello,

One of the thing I noticed being 'crawled' from SimplePress 4 is the fact that user uploaded avatars are being resized inline. (i.e. if a user uploads a 1000x1000px photo, in order to display their avatar on all the posts, that huge photo is getting loaded). And not all users are enough tech savvy to only upload an already shrank photo for their avatar.

Since Wordpress already provides the means to resize photos and create thumbnails, would there be a way for you to kook up in their API and provide the avatars in a 'thumbnail' size ? (just a suggestion).

Like running the image through a resizing script before placing it in /wp-content/forum/forum-avatars/

I personally run all the images in forum-avatars through a resizing script that shrinks them down every now and then. This helped lower the page loading time significantly. I'm sure I'm not the only one having such problems, so a lot of users might benefit from this improvement.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Sep 1, 2012 - 10:42 am

we have an open ticket to check the uploaded size against some limits... but the plan is to reject them, not resize...  but we can consider the alternative...

Avatar
adesigns development
Rookie
Free Members
Offline
Sep 1, 2012 - 10:59 am

Resizing them on the fly would certainly be more user friendly, as not all forum users are that tech savvy to know how to resize a photo.

You can use this function:

http://codex.wordpress.org/Fun.....age_resize

Running the already uploaded avatar through something like the following might help:

<?php $resized_avatar = image_resize( $the_recently_uploaded_avatar, 150, 150, true, '_thumbnail', '/wp-content/forum/forum-avatars/', 90); ?>

(I used 150 here just as an example, as a maximum 'decent' size a forum avatar would show up. this can inherit the value from Profiles -> Avatars, under the "Maximum avatar display width (pixels)" setting).

Here you can also set a checkbox for either cropping them or not, and adjust the 150, 150, true (for cropping enabled that always gives square avatars) or 150, 150, false (which makes them fit inside the 150, 150 margins, and not always getting a square avatar).

The function returns the destination path of the resized avatar. You can store this in the user attributes instead of the original uploaded image and that would make a lot of people happy.

Let me know if I can further help or test this potential functionality improvement.

Thanks!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Sep 1, 2012 - 11:18 am

yes, we understand... As I said, a ticket is open for this and we are aware of the function (thanks for link though!)...

problem we run into is image processing/resizing is computationally intensive... and some folks exhaust their php memory when they upload a large image (as you referenced) and then resize it... some folks still run their sites at 32MB... users get more frustrated when this happens because of the error... but we will consider it...

Avatar
adesigns development
Rookie
Free Members
Offline
Sep 1, 2012 - 11:20 am

I've even tested this function, and it can work properly for this task.

I've went into /simple-press/forum/profile/ahah/sp-ahah-profile-save.php

and tested the following, by putting them after:

# valid avatar, so try moving the uploaded file to the avatar storage directory

# valid avatar, let's resize it

$uploadfile_resized = image_resize( $_FILES['avatar-upload']['tmp_name'], 150, 150, true, '', '/problem-with-post-edit-buttonome/domain_name.com/www/wp-content/forum/forum-avatars/', 90);

It successfully placed an 150x150 cropped picture in there, while the $uploadfile_resized received the location of the newly created avatar.

I haven't gone through the entire file to complete the process, but hopefully this would take you several steps closer to actually implementing this functionality.

Avatar
adesigns development
Rookie
Free Members
Offline
Sep 1, 2012 - 11:22 am

Then maybe add a checkbox 'resize images'... (or not?) With it defaulting at being 'false'.

This way beginner users running on low-end servers will get a proper forum working on their end, while more advanced users can activate such features in order to further increase the performance of their forum. Everyone is hyped about speed nowadays laugh

Thanks for considering my suggestion.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Sep 1, 2012 - 11:48 am

thanks for the code segment... have noted it... may even try to accelerate the ticket since you went to the trouble! ;)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Sep 2, 2012 - 12:09 am

looks like I will get this in the next version... bit different than what you posted, but helpful none the less... changes committed and in testing...

Avatar
adesigns development
Rookie
Free Members
Offline
Sep 3, 2012 - 9:00 am

Really happy to hear that. I'm glad you found my suggestion helpful as well.

Enjoy taking care of such a nice piece of software!

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Sep 4, 2012 - 1:34 am

I think you hit it at the right time... Steve was itching for an interesting small project to do!

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625