Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Account Pictures

This discussion is related to the Account Pictures addon.


  • Is there not an extension specific configuration page?
  • T1, yes unfortunately it does that. The easiest (but fiddly) way is to correct it in the database using phpmyadmin etc (backup first!). In the table LUM_User do an SQL search in the Picture field for your domain-name and remove it altogether s that teh path starts with the opening / after the domain. From then on it should be okay if you transfer to another server, providing of course you don't change the path structure.

    The way to stop it in future is to find the two lines below (a few lines apart from each other) in function AccountPicturesForm (about 1/3 way into the default.php for the add-on) and replace BASE_URL (which includes the whole domain) with WEB_ROOT (which begins from the first / after the domain). You can verify the values for these in your conf/settings.php file:

    $User->Icon = $Context->Configuration['BASE_URL'] . $Context->Configuration['ACCOUNTPICTURES_UPLOAD_PATH'] . $FileName;
    $User->Picture = $Context->Configuration['BASE_URL'] . $Context->Configuration['ACCOUNTPICTURES_UPLOAD_PATH'] . $FileName;
  • I am not well versed in SQL statements. Can you give me some code to copy/paste? I appreciate the help!
  • I'm not well versed in SQL either, but I can use google ...

    UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
    which I guess would translate to:

    UPDATE LUM_User SET Picture = replace(Picture,"","");
    (as always backup first if you're not sure!)
  • @Jakob_r
    Thanks for your help, I was able to get it working with the SQL statement.

    Thanks also for your direction to prevent this in the future. HOWEVER - Its seems the WEB_ROOT/BASE_URL doesn't have a purpose in the extension. It adds needless information into the database. For example, the WEB_ROOT value for my forum is infact "/forum/" this means when it writes to the database it which would cause me the same problem if i moved it to a dir called say "community". Really the only necessary/proper path should be the relative path to the pictures/icons by default "uploads/AccountPictures/" which is not likely to change as you move your forum.

    Unless my understanding of WEB_ROOT is incorrect and then therefore incorrect on my install. Is there documentation somewhere on what those should be or how they are generated.
  • I'm having a conflict between the Predefined Attributes extension and this one.
    When trying to upload an image, I receive this error:

    Notice: Undefined property: UserManager::$User in /extensions/PredefinedAttributes/default.php on line 509
    The image does get uploaded and assigned successfully though.

    The referenced line is around:

    function PredefinedAttributes_AddFromPersonalInformation($UserManager) { $pa = new PredefinedAttributes($UserManager->Context, $UserManager->User); $pa->AddFromPersonalInformation($UserManager); } $Context->AddToDelegate('UserManager', 'PreIdentityUpdate', 'PredefinedAttributes_AddFromPersonalInformation');
  • Strange Ben, I'm using both and have no problem on that count (I have commented out the User Icons, though). Perhaps it's a plug-in order thing (FWIW: on mine Predefined Attributes is positioned after AccountPictures in conf/extensions.php).
  • That solved the problem straight away Jakob. I just switched those two lines over. Thanks.
  • I've asked this before I still haven't been able to find an answer to this, but when you use this extension, you can upload two files-- the icon and the picture. Why do you upload the picture? I doesn't appear to display anywhere beside the upload page.
  • i haven't used this addon, but you can display a picture on your profile page, and your icon follows you around.
  • Let me clarify: I upload an account picture (icon is working fine), and this picture uploads fine, and is displayed on my account pictures setting page (showing the current picture uploaded), but the picture does not show up on my account profile page (All I see is the icon, name, and the user attributes data). Is there anything I have to do in the default.php of this to turn the feature 'on'?

    Got it to work by changing line 23 in account_profile.php from
    if ($this->User->Picture != "" && $this->User->Permission('PERMISSION_HTML_ALLOWED')) echo "<li class=\"Picture\" style=\"background-image: url('".$this->User->Picture."');\">&nbsp;</li>";
    if ($this->User->Picture != "" ) echo "<li class=\"Picture\" style=\"background-image: url('".$this->User->Picture."');\">&nbsp;</li>";

    If anyone can explain to me where to either set PERMISSION_HTML_ALLOWED to true for all users, or why its there, that would be great.
  • Does this add on have all the latest fixes configured into the download. From reading the thread it seems user came across a lot of small bugs with reconmendations on how to fix it. There seems to many to even attempt. Have all the fixes been placed in the download so we can avoid mucking around in these files.
  • users get confused when theres the Account Picture and Icon stuff on the personal information page AND a separate page for uploading account pictures. it seems like it would be more intuitive if the uploading functionality could be integrated with the personal information page.
  • All you'd need to do is just hide the URL fields for icons from the Personal Information page. The Account Pictures extension fills them in anyway.
  • Yeah... but still. I think it would be nice to have it all on one page.
  • Does anyone know how the image names are created? I'm wondering if it would be possible to have them be named something like:


    or something to that effect.
    I'm trying to show information outside of vanilla (in wordpress) and I don't really know how to do the queries for that. So instead of looking up the users icon in the database, I'm thinking maybe I can just point an to uploads/AccountPictures/icon_accountID.gif or something.

    unless someone can help me with the mysql queries...
  • I get the following error when trying to add pictures to my account:

    Fatal error: Cannot redeclare class phpthumb in /XXXXXXXX/forum/extensions/AccountPictures/phpThumb/phpthumb.class.php on line 18

    Does anyone know why this might be? I'm using Vanilla 1.1.4
  • phpThumb() v1.7.7-200612252156 in file "phpthumb.class.php" on line 216 setSourceFilename(/home/hobbybag/public_html/vanilla/uploads/a9a9b44c8012146d6c1bbf0a86e16c86.jpg) set $this->sourceFilename to "/home/hobbybag/public_html/vanilla/uploads/a9a9b44c8012146d6c1bbf0a86e16c86.jpg" in file "phpthumb.class.php" on line 234 file_exists() = 0 in file "phpthumb.class.php" on line 1036 is_executable() = 0 in file "phpthumb.class.php" on line 1037 using ImageMagick path from `which convert` (/usr/bin/convert) in file "phpthumb.class.php" on line 1056 ImageMagick version checked with "convert --version" in file "phpthumb.class.php" on line 1083 ImageMagick convert --version says "Version: ImageMagick 6.2.6 12/21/06 Q16 http:" in file "phpthumb.class.php" on line 1091 Addding ImageMagick formats to $AvailableImageOutputFormats (text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 819 $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 825 $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 835 $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 852 !$this->config_allow_src_above_docroot therefore setting "/home/hobbybag/public_html/vanilla/uploads/a9a9b44c8012146d6c1bbf0a86e16c86.jpg" (outside "/usr/local/apache/htdocs") to null in file "phpthumb.class.php" on line 1001 $this->sourceFilename set to "" in file "phpthumb.class.php" on line 754 phpThumb() v1.7.7-200612252156 "" does not exist in file "phpthumb.class.php" on line 3404 setCacheDirectory() starting with config_cache_directory = "" in file "phpthumb.class.php" on line 859 $this->config_cache_directory () is not a directory in file "phpthumb.class.php" on line 895 SetCacheFilename() failed because $this->config_cache_directory is empty in file "phpthumb.class.php" on line 2808 starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 2665 GetImageSize("") failed in file "phpthumb.class.php" on line 2688 $this->useRawIMoutput=false because "fltr" is set in file "phpthumb.class.php" on line 1151 ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty in file "phpthumb.class.php" on line 1196 ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 2695 SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 2644 SetOrientationDependantWidthHeight() setting w="280", h="200" in file "phpthumb.class.php" on line 2660 exif_thumbnail() does not exist, cannot extract EXIF thumbnail in file "phpthumb.class.php" on line 2742 starting SourceImageToGD() in file "phpthumb.class.php" on line 3005 $this->useRawIMoutput=false because "fltr" is set in file "phpthumb.class.php" on line 1151 ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty in file "phpthumb.class.php" on line 1196 Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3046 $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3098 ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3100 phpThumb() v1.7.7-200612252156 Unknown image type identified by "" () in SourceImageToGD()[3210] in file "phpthumb.class.php" on line 3404 SourceImageToGD() failed in file "phpthumb.class.php" on line 312

    Why am I getting this error?!
  • If you'd like the image is scaled to the maximum dimension (as I believe it used to be), rather than scaled to the minimum dimension and then cropped on the large direction, comment out the line

    // $phpThumb->setParameter('zc', '1');
    in function CreateImage in default.php.

    Reason: zc=1 switches on zoomcrop for phpthumb. zoomcrop is perhaps good for photos where most people are the centre of the photo but it is no good for logos.
  • awww, crap. can anybody tell me how to chmod the files. the server i'm working at has some problems with this stugg, so i have to define the chmod value somewhere...
  • I have been trying to give myself an icon for the past 2 weeks now, and after I save the icon in the Account Pictures settings page, it redirects me to a blank page with a little black square icon in the upper left corner that reads nogd. What does that mean??? I have made the upload folder, set my permissions right and it just won't work for me.
    Come to find out, it has something to to with php-gd. You have to have it installed. I didn't. So for all you guys who get that little icon of noGD, now you know. -actually, it might be a good idea to list php-gd as one of the requirements in the AccountPictures "read me" file so the user doesn't have to go searching all over the net trying to find out what that little nogd icon means. For the beginner, I think it should be easier than this.
  • "I was running into a problem where if I specified both the icon and account picture on the same submit I got "cannot redeclare phpThumb class", so I changed line 148 to include_once rather than include and that seems to have fixed it."

    I had the same problem, came to the same conclusion, did the same fix. :)
  • The problem I'm finding at the moment, is someone has specified an off-site image as their icon. Although it's 32 pixels wide. It's something like 128 pixels tall.

    It works fine if you upload a picture through the interface. I'm tempted to just edit the code so people can't inject a URL themselves, as this appears to the be only issue. And honestly, I think I'd sooner disable off-site images anyway.

    But on the off chance, has anyone else had this problem and/or fixed it?

    I'm using GD, not ImageMagick btw.


    I didn't realise, but the ability to have an avatar as an off-site URL is built into Vanilla. The add-on is working perfectly, but it conflicts with the built in functionality. Is there a way of easily removing the options for those URLs in the Account settings, without editing too many files?

    Update 2:

    I have removed this functionality, by editing account_identity_form.php. Search for the line with "GetDefinition('AccountPicture') and I've changed the code to the following, which basically remarks the old code and adds in two hidden elements with the previous data in, to stop the values being erased. This doesn't protect against POST injection, but that's not a huge problem.

    echo '






    //new code

    echo '
  • As administrator I tried to go into a user profile and upload a new avatar for them, it does not show the users account photos area though it shows the administrators, seems like a bug
  • Jazz,

    The Account Pictures and the Vanea Black theme aren't playing nice with each other.

    help? thanks!
  • When I upload a new account picture that's portrait - say 600 long, 200 wide. I would expect it to resize it to the maximum height, and then crop the width - not the other way around.

    In my eyes, it needs some portait/landscape detection to know which takes priority, width or height.
  • Update: fixed a bug with people who don't have an uploaded image.

    The following modification will IGNORE the height value. Any image will be resized to the set width (280 default). This is great for uploading portrait images.

    First, find:

    $this->Picture = $User->Picture . '?' . time();

    And afterwards add:

    if ($User->Picture)
    $imagedetails = getimagesize($this->Picture);
    $this->PictureHeight = $imagedetails[1];

    This gets the size of the uploaded image, so that the style is set correctly on the image with viewing the images on the upload page.

    Then, find:

    $phpThumb->setParameter('h', $NewHeight);

    And remark the line. This means that only a new width is passed to phpthumb and is therefore scaled proportionally.

    Then find:

    $AddStyle = str_replace('{PictureHeight}', $Context->Configuration['ACCOUNTPICTURES_PICTURE_HEIGHT'], $AddStyle);

    And replace it with:

    $AddStyle = str_replace('{PictureHeight}', $pheight, $AddStyle);

    Any time before this line, say above all the $AddStyle declarations, add:

    $pheight = $Context->Configuration['ACCOUNTPICTURES_PICTURE_HEIGHT'];

    if ($Context->SelfUrl == 'account.php' && $Context->Session->UserID > 0)
    $tuser = $UserManager->GetUserById($Context->Session->UserID);

    if ($tuser->Picture)
    $imagedetails = getimagesize($tuser->Picture . '?' . time());
    $pheight = $imagedetails[1];

    And you're done! Note that this uses the GD library to get the image details. So if you're using ImageMagick, unless you have GD compiled as well, this won't work.
  • anyone else notice that you cannot upload a avatar and a profile picture at the same time?
  • It has been mentioned. Possibly something to do with the upload class being used twice and causing conflicts or something. hmm..
Sign In or Register to comment.