Provide a way to organize avatars

I submitted a ticket concerning avatars.  If anyone has any comments or suggestions for improvement, lets hear 'em.

http://www.boonex.com/trac/dolphin/ticket/1470

Currently, avatars must be named 1.jpg, 2.jpg... 200.jpg

That's ok....BUT

I have no idea how the display order of these avatar images is determined in the site avatar listing on the 'Choose avatars' block.

What is desperately needed, as far as avatars are concerned, is a way to organize them into categories determined by the site admin. It would also be nice if the file names did not have to be numerical.... I'd like to be able to upload new avatars without having to name hundreds of images to a numerical file name.

What would be great, is if I could create subdirectories in the /modules/boonex/avatar/data/ready/ folder so that I can categorize avatar images.

For example, Id like to organize Football, Baseball, and Basketball avatars. I'd like to upload these avatars to folders as such:

/modules/boonex/avatar/data/ready/Football

/modules/boonex/avatar/data/ready/Baseball

/modules/boonex/avatar/data/ready/Basketball

Then, in the 'Choose avatar' block, I'd like members to be able to select 'Football', 'Baseball', or 'Basketball' avatars from a dropdown list, and only the avatars in the corresponding folder on the server would be displayed.



My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 16 Nov 2009

aah, that's why my own avatars wouldnt work, they start with 0.. Ok, now that I know that the whole problem is solved. I like the idea of having them categorised. Dropdown or an image of a folder with the category name would work perfectly. Also, on the avatar part, I'd like it if members were able to uncheck the "Add to photo album" checkbox after browsing for a picture. Just a suggestion. And a second option to upload from an URL.

 

Good suggestion about the categories houstonlively, and thanks for solving my problem :)

Quote · 16 Nov 2009

I don't know if this has been sorted, If so I couldn't find the answer on the forums. So I did a little delving into the code and figured out what the display order is. Basically the avatars aren't ordered at all, they are just loaded in the order that they are stored on the server.

I numbered all my avatars sequentually and uploaded them expecting to see them in order, but as you are probably aware they were all mixed up. So I changed a bit of code so that the avatar files are sorted numerically before the system applies it's pagination. This at least allows you to keep your avatars in category blocks. It just takes a bit of planning with the numbers.

The file I modified is:

/modules/boonex/avatar/classes/BxAvaModule.php

Scroll down to around line 436 and look for the following:

function serviceGetSiteAvatars ($iPage) {
$iPage = (int)$iPage ? (int)$iPage : 1;
$iPerPage = 12;
$iCounter = 0;
$iStart = ($iPage-1) * $iPerPage;
$aFiles = array ();
if ($h = opendir(BX_AVA_DIR_SITE_AVATARS)) {
while (($sFile = readdir($h)) !== false) {
if ('.' == $sFile[0]) 
continue;
if ($iCounter++ < $iStart)
continue;                
if ($iCounter - $iStart <= $iPerPage)
$aFiles[] = array ('url' => BX_AVA_URL_SITE_AVATARS . $sFile, 'name' => $sFile);
}
closedir($h);
}


And replace with:

function serviceGetSiteAvatars ($iPage) {
$iPage = (int)$iPage ? (int)$iPage : 1;
$iPerPage = 12;
$iCounter = 0;
$iStart = ($iPage-1) * $iPerPage;
$aFiles = array ();
$allFiles = array();
if ($h = opendir(BX_AVA_DIR_SITE_AVATARS)) {
while (($pFile = readdir($h)) !== false) {
if ('.' == $pFile[0])
continue;
else
$allFiles[] = $pFile;
}
closedir($h);
sort($allFiles);  

foreach($allFiles as $sFile) {   
if ($iCounter++ < $iStart)
continue;               
if ($iCounter - $iStart <= $iPerPage)
$aFiles[] = array ('url' => BX_AVA_URL_SITE_AVATARS . $sFile, 'name' => $sFile);
}
}

Remember to backup the original BxAvaModule.php before making any alterations, so that you can copy the original file back if anything goes wrong!

It's not the best solution but at least you can group avatar subjects together until a better solution arrives, or if there is one could you point it out to me please.

Quote · 23 Feb 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.