Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
avatar resizing no longer working
Avatar
Marc Busch
Member
Free Members
sp_UserOfflineSmall Offline
Aug 15, 2013 - 3:00 pm

It seems that my users cannot upload avatars since I moved the site to a new server (at Liquidweb).

They always get an error saying that something went wrong with resizing the image.

The problem is solved by deactivating "Auto resize avatar uploads" in the Forum option.

However, I'd like to have these uploads resized automatically as there will certainly be members who don't care (or don't know) about avatar size. :)

It worked well on the previous server.
What could be the reason why the resize option is not working anymore?

Does the resize function require anything specific (except simple press) being installed on the server?

The permission setting of the avatar folder (where the images are stored) is 777 (rwxrwxrwx), so that should not be the problem.

Marc

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 15, 2013 - 3:12 pm

I will need to check with Mr Papa who wrote that but I suspect it will require the GD graphics library to be compiled with your PHP. You might like to ask your host if this is present or not...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 15, 2013 - 7:26 pm

you should not have a directory with 0777 - that is risky and could cause server issues...

any errors in the log?  what exactly is the error message...

You say you updated SP, but what version of WP?  The avatar resizing uses functions built into WP...  they are not our own...

Avatar
Marc Busch
Member
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 2:19 am

What setting (instead of 0777) should I use for that folder?

The error I get in the forum when the "resize" option is activated is this:
avatarProblem01.pngImage Enlarger

There are few errors in the error log that might be related to this:
avatarProblem02.pngImage Enlarger

The software versions I have installed are:
SP 5.2.6
WP 3.5.2

So, is the "GD graphics library" a possible reason for the problem?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 16, 2013 - 4:44 am

Best and preferred folder permission setting is 755. Some hosts will not actually serve data if the folder is 777.

Doesn't seem a GD library issue so that's OK.

Looks like those errors in your log point to the issue but I am unsure yet what that might be. Will need to do a little code research and possibly wait for Steve (Mr Papa) to arrive on the scene. Seems to be something to do with the avatar file name...

We'll come back on this asap.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Marc Busch
Member
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 4:47 am

Thanks. Will change the permission setting...

I get the same error no matter what the filename (unless something is wrong with test.jpg or test.png). I also tried uploading a simple 80x80 pixel white rectangle (filesize < 1kb) as avatar and get the same error.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 10:45 am

you should still check with your host...  wp still needs the GD or ImageMagik library to do its thing..

its a wp function and you would have to do more internal checking to see what the error is...

to get more info, you would need to make a slight code mod and dump the wp error to the screen so we can see what they are complaining about...  up to that?

Avatar
Marc Busch
Member
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 11:11 am

Sure, how can I do this?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 11:21 am

find file simple-press/forum/profile/ahah/sp-ahah-profile-save.php...  down around line 348, find this section of code:

                $sfavatars = sp_get_option('sfavatars');
                if ($sfavatars['sfavatarresize']) {
                    $editor = wp_get_image_editor($uploadfile);
                    if (is_wp_error($editor)) {
                        @unlink($uploadfile);
                        $message['type'] = 'error';
                        $message['text'] = sp_text('Sorry, there was a problem resizing the avatar');
                        return $message;
                    } else {
                        $editor->resize($sfavatars['sfavatarsize'], $sfavatars['sfavatarsize'], true);
                        $imageinfo = $editor->save($uploadfile);
                        $filename = $imageinfo['file'];
                    }
                }

after the line

                    if (is_wp_error($editor)) {

add this:

                        ashow($editor);

when you save upload an avatar and it gets resized, this should dump the wp error object to the screen and give more info as to why wp failed to resize it...

Avatar
Marc Busch
Member
Free Members
sp_UserOfflineSmall Offline
Aug 16, 2013 - 12:35 pm

Hmm... doesn't seem to work.

 

After editing the code and activating "avatar resizing" in the forum options, now nothing happens when I click the "upload avatar" button. Also the (green) error message 'Sorry, there was a problem resizing the avatar' does not appear.

Is it possible that ashow($editor); throws an exception?

Any alternative?

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
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: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625