Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

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

+1 vote
5,648 views
asked Feb 21, 2012 in Q2A Core by q2apro
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
answered Feb 22, 2012 by gidgreen
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.
commented Mar 7, 2012 by gidgreen
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?
commented Mar 7, 2012 by q2apro
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?
commented Mar 8, 2012 by gidgreen
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'.
commented Mar 8, 2012 by q2apro
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 ;)
...