Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

AvatarUploader+ImageResizer.php

ToivoToivo New
edited May 2006 in Vanilla 1.0 Help
this functions promises. false= updates only icon not image. in reality it's upside down. false= updates only image not icon. how to change? Maurice Krijtenberg or Nader Cserny could change it? define( "UseUploadedPictureAlsoForIcon", true ); // this writes the path of the icon into the database field "picture", so one picture is used for both displays, icon and picture. you can set this to false if you don't want this to happen. ... // Update user account $IconPath = "http://" . agDOMAIN . "/images/avatars/" . $Avatar->AuthUserID . "." . $file_ext; $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder"); $s->SetMainTable("User", "u"); $s->AddFieldNameValue("Picture", $IconPath ); // HACK by brandinfection.com: if switch for using the icon also as a picture if( UseUploadedPictureAlsoForIcon == true ) { $NewImgTarget = str_replace($Avatar->AuthUserID . "." . $file_ext, "icon_" . $Avatar->AuthUserID . "." . $file_ext, $target); // HACK: resize the icon too (07.12.05) resize($target, $NewImgTarget, 32, 32, 87); $IconSaveLoc = str_replace($Avatar->AuthUserID . "." . $file_ext, "icon_" . $Avatar->AuthUserID . "." . $file_ext, $IconPath); $s->AddFieldNameValue("Icon", $IconSaveLoc); } $s->AddWhere("UserID", $Avatar->AuthUserID, "="); $this->Context->Database->Update($this->Context, $s, $this->Name, "SaveAvatar", "An error occurred while attempting to update the avatar data."); } else { $this->Context->ErrorManager->AddError($this->Context, $this->Name, "SaveAvatar", "Could not upload avatar image."); } } return true; }

Comments

  • actually, I think you miss interrupted what that does. it says <i>UseUploadedPicture<b>Also</b>ForIcon</i> so I'm assuming that the Also part means it will work for both icon and picture, else it would be just for the picture.

    I tried finding a way to just get it to work right, but couldnt. I think I found out why though and I'll try to look into this further but I cant guarantee I'll come up with a solution. One thing I can say though is that once the file is uploaded it would be safe to chmod it to 644 because I'm not allowed to delete any of the uploaded files through ftp - permission denied. I'm gonna have to do it through shell.
  • Anyway. It would be nice if the new extension would work only for *icons*. Any volunteer who might create such extension?
This discussion has been closed.