ok, its working great. make sure the size is 80/80 or whatever. by default it only said 80. since i've made the change its working beautifully.
except,
what do i need to do to get the widget working?
ok, its working great. make sure the size is 80/80 or whatever. by default it only said 80. since i've made the change its working beautifully.
except,
what do i need to do to get the widget working?
just drop it into your widgets folder.
When your bloggers move the widget into their sidebar then it will pull from whatever image they've uploaded and will display whatever content they've writen to the "About Me" section of their Profile.
beautiful work!
thanks :)
Hey Suleiman, I'm using code to get the latest posts on the front page of my main blog - Do you know how can I get their avatar to show up as a small icon next to them?
i cant check from work, but try going thru the plugins and see what he uses to get them in the comment section. anyone think of a reason that might not work?
you mean in the actual code? Yeah I can't check from here either.. I'm also not a PHP wiz, so I am no help!
Can't get it to upload at all on FF2 even with the form modification in.
It happily displays an avatar if I upload default.jpg to /wp-content/avatars.
Steve, visit my site for a possible fix that corey posted:
http://suleiman.hadithuna.com/wpmu-avatar-pack-release/#comment-245
has anybody managed to find a solution to the upload problem?
i've also added this to my profile.php but nothing happens :(
enctype="multipart/form-data"
Yeah... BURN INTERNET EXPLORER TO HELL!!!!
But seriously. I've done the same, didn't work. Not sure what to do there. It hasn't been that big of a deal considering all my visitors use moz but I'd still like to know.
it works, but the refresh is slow. after you've used the above fix, it takes a little time for the avatar to appear. but it works great. now, if someone could explain to me how to include the avatar in the feed!
Another possible cause for images not uploading: GD image module not installed with php & Apache.
Well it will upload - and delete once, and then that's it - once its deleted the avatar it just silently fails to upload a new one..
I ruled out the GD module as well for me. *sighs*
I think suieleman is getting married soon, hence the reason he's busy.
*cough* found it.. I think.
Try uploading a file that HAS to be resized.... I think you'll find it works!
OK I've hacked the code around and the following replacement upload_pic function seems to work:
function upload_pic() {
global $image_dir, $user_ID, $image_extensions, $profile_picture_options;
$raw_name = (isset($_FILES['picture']['name'])) ? $_FILES['picture']['name'] : "";
// if file was sumbitted, continue
if ($raw_name != "") {
// build the path and filename
$clean_name = ereg_replace("[^a-z0-9._]", "", ereg_replace(" ", "_", ereg_replace("%20", "_", strtolower($raw_name))));
$file_ext = substr(strrchr($clean_name, "."), 1);
$file_path = clean_path(ABSPATH . '/' . $image_dir . '/' . $user_ID . '.' . $file_ext);
// store file
if(filesize($_FILES['picture']['tmp_name']) > $profile_picture_options['maximum_size'] * 1000)
{
unlink($_FILES['picture']['tmp_name']);
die("<p><strong>Error:</strong> Profile pic file size is above the maximum size " . $profile_picture_options['maximum_size'] . "KB.</code></p><p>Please <a href='javascript:history.go(-1)'>go back</a> and try again.");//Stolen from Andrew Ferguson
return;
}
$dimensions = getimagesize($_FILES['picture']['tmp_name']);
if (extension_loaded('gd') && function_exists('gd_info'))
{
switch ($file_ext)
{
case "jpg": $image = imagecreatefromjpeg($_FILES['picture']['tmp_name']);
break;
case "png": $image = imagecreatefrompng($_FILES['picture']['tmp_name']);
break;
case "gif": $image = imagecreatefromgif($_FILES['picture']['tmp_name']);
break;
default:
unlink ($file_path);
die("<p>Unknown Image Format<a href='javascript:history.go(-1)'>go back</a> and try again.");
break;
}
$new_image=$image;
if (isset($image))//Copied from PHP Manuals / with inspiration from myGallery
{
if( $dimensions[0] > $profile_picture_options['maximum_size'] || $dimensions[1] > $profile_picture_options['maximum_size'] )
{
if ($dimensions[0] >= $dimensions[1])
{
$resize_x = $profile_picture_options['maximum_width'];
$resize_y = (int) ($dimensions[1]*($profile_picture_options['maximum_width']/$dimensions[0]));
} else
{
$resize_x = (int) ($dimensions[0]*($profile_picture_options['maximum_width']/$dimensions[1]));
$resize_y = $profile_picture_options['maximum_width'];
}
if ($file_ext=='gif')
{
$new_image = imagecreate($resize_x, $resize_y);
} else
{
$new_image = imagecreatetruecolor($resize_x, $resize_y);
}
imagecopyresampled($new_image, $image, 0, 0, 0, 0, $resize_x, $resize_y, $dimensions[0], $dimensions[1]);
}
// OK By now we've got either the original image or the resized image
switch ($file_ext) {
case "jpg":imagejpeg($new_image, "$file_path",80);
break;
case "png": imagepng($new_image, "$file_path",80);
break;
case "gif": imagegif($new_image, "$file_path",80);
break;
}
}
}
else {
unlink ($file_path);
die("<p><strong>Error:</strong> Profile pic size is larger than Maximum Width/Height of " . $profile_picture_options['maximum_width'] . " pixels and cannot be resized.</code></p><p>Please <a href='javascript:history.go(-1)'>go back</a> and try again.");//Stolen from Andrew Fergus
}
}
else
{
return false;
}
}
is this replacement more efficient?
More efficient?? well logically its more correct than the original and it works for resized as well and original sized images...
Thanks Steve.
thanks!
I take those last two comments to mean that it works?
i got a WP install parked and an integrated BBpress both in in subdirs. how tough would it be to hack your plugin to work on every site on my domain? i'd like the avatars to show up in my forums.
Anyone done an extension to list all profiles of all authors?
Steve's code gave me errors and the thumbnails were coming out ugly squashed in the original.
If GD works for you this code can make the thumbnails into squares but also crop it from the center so they look good.
For a cropped square 64 Replace
$new_image = imagecreatetruecolor(64,64); imagecopyresampled($new_image, $image, 0, 0, 0, 0, 64, 0, $dimensions[0], $dimensions[1]); imagejpeg($new_image, "$medium_file_path"); imagedestroy($new_image);
With
list($ow, $oh) = getimagesize($_FILES['picture']['tmp_name']); $big = imagecreatefromjpeg($_FILES['picture']['tmp_name']); $new_image = imagecreatetruecolor(64,64); if ($ow > $oh) { $off_w = ($ow-$oh)/2; $off_h = 0; $ow = $oh; } elseif ($oh > $ow) { $off_w = 0; $off_h = ($oh-$ow)/2; $oh = $ow; } else { $off_w = 0; $off_h = 0; } imagecopyresampled($new_image, $big, 0, 0, $off_w, $off_h, 64, 64, $ow, $oh); imagejpeg($new_image, "$medium_file_path"); imagedestroy($new_image);
I did a quick post to show you the difference in the photos:
http://dev.honewatson.com/profile-picture-plugin-wpmu-crop-thumbnails/
Much better! Mind you all I was doing was fixing code so that actually processed different sized images and replacement images. So the code you've replaced isn't actually mine ;-)
hone, the fix you've made will be incorporated into the next release, if that's alright with you.
Also bundled will be the bbpress integration, though not in the form of a plugin, since many of us don't have our bbpress forums sharing much more than the users table from our wpmu database.
Fine with me using the code I wrote suleiman. :)
I downloaded WPMU Avatars 1.0 and tried to replace honewatson's code, but it's returning T_VARIABLE error.
Also above code seems to be changed in WPMU Avatars pack. Could you please supply new code?
Thank you.
« Previous 1 2 3 4 Next »