Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
6.7k views
in Q2A Core by
After uploading an image to the profile, the following error message appears:

PHP Notice:  Undefined index:  channels in /qa-include/qa-util-image.php on line 72

 

Line 72 is:
$needbytes+=$width*$height*$imagesize['bits']*$imagesize['channels']/8*2;
// memory to load original image
 

help?

1 Answer

+1 vote
by
This appears to be a PHP bug - the documentation promises these elements will always be in the array, but in fact they can sometimes be absent. I'll look into fixing this for Q2A 1.5.1.
by
Hi gidgreen, thanks for helping out. Do you already have an idea how to fix this?

When changing avatars (image upload) the users gets error notices due to this bug:
1. Username must not be empty
2. Email address required - not public

I would be glad to fix this soon, even if changing the avatar works.
by
These other errors surprise me. Please post a link to your site, so I can try to reproduce them when uploading an avatar image.
by
here you go, but still in beta:
http://www.gute-mathe-fragen.de/
by
I can see them on your site, but can't reproduce them in my own Q2A 1.5. Did you modify qa-page-account.php at all, or the qa_handle_email_filter() function in qa-app-users-edit.php, or something else in the core code?
by
Hi gidgreen, thanks for your help. To prevent email editing I did change qa-page-account.php: After line 221 I added: 'type' => 'static'.
I got this tip here from q2a-forum.

Now I removed this line, uploaded a new avater, and the errors are gone.

Mhh.. so that brings back the other question: How to disable the edit option for usermails?
by
If you want to make the email not editable, just change this in qa-page-account.php:

$inemail=qa_post_text('email');

... to ...

$inemail=$useraccount['email'];

You can then give the email field a type of 'static'.
by
very good. Tested it, now changing the avatars works without any error message.

Thank you a lot!


PS: The only thing left is the undefined index bug posted in the original question according to my error.log ;)
...