Support Forum
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.
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...
Visit Cruise Talk Central and Mr Papa's World
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!
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...
Visit Cruise Talk Central and Mr Papa's World
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.
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
Thanks for considering my suggestion.
thanks for the code segment... have noted it... may even try to accelerate the ticket since you went to the trouble!
Visit Cruise Talk Central and Mr Papa's World
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...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)