Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
712 views
in Q2A Core by
avator-default-width and avatar-default-height in qa-options table is not set.

qa_image_constrain_data() in qa-util-image.php is correct? I think that width and  height variables are not set... avator-default-width and avatar-default-height is used qa_get_user_avatar_html() in ga-app-users.php.
Q2A version: 1.5.1

3 Answers

+1 vote
by
These values are set once you upload a default avatar, no? They refer to the height and width of the default avatar, not the default height and width of avatars in general.
+1 vote
by

I also encounter this problem 

in function qa_get_user_avatar_html() the last variable is of padding. So when q2a fetches user list via above function it passes padding variable as true , which create strange padding.

0 votes
by
edited by

 

I corrected in lower code.
 
function qa_image_constrain_data($imagedata, &$width, &$height, $size)
/*
Given $imagedata containing JPEG/GIF/PNG data, constrain it proportionally to fit in $size (square)
Return the new image data (will be a JPEG), and set the $width and $height variables
*/
{
$inimage=@imagecreatefromstring($imagedata);
 
if (is_resource($inimage)) {
$inwidth=imagesx($inimage);
$inheight=imagesy($inimage);
 
$outwidth=$inwidth;
$outheight=$inheight;
 
// always call qa_gd_image_resize(), even if the size is the same, to take care of possible PNG transparency
qa_image_constrain($outwidth, $outheight, $size);
qa_gd_image_resize($inimage, $outwidth, $outheight);
 
// add [start]
$width=$outwidth;
$height=$outheight;
// add [end]
}
 
if (is_resource($inimage)) {
$imagedata=qa_gd_image_jpeg($inimage);
imagedestroy($inimage);
return $imagedata;
}
 
return null;
}

 

...