Returns the path to upload the associated avatar to.
769682
def get_avatar_upload_to(self, filename):
        
        dummy, ext = os.path.splitext(filename)
        return os.path.join(
            machina_settings.PROFILE_AVATAR_UPLOAD_TO,
            '{id}{ext}'.format(id=str(uuid.uuid4()).replace('-', ''), ext=ext),
        )
593011
public function uploadProfilePicture()
    {
        // If no file was uploaded, do nothing
        if (null === $this->getProfilePictureFile())
        {
            return;
        }

        $file = $this->getProfilePictureFile();

        $image = Image::createFromUploadedFile($file);
        $file->move($image->getUploadDir(), $image->getFilename());

        $this->setProfilePicture($image);

        // Clean up $profilePictureFile since we won't need it any more
        $this->profilePictureFile = null;
    }
43274
function getPath(image, s, wantsRetina) {
  if (s === 0) { return image.src; }

  var parts = image.src.split('.');
  var ext = parts.pop();

  return parts.join('.') + '-' + s + (wantsRetina ? '@2x' : '') + '.' + ext;
}
635878
def robo_avatar_url(user_data, size=80):
    """"""
    hash = md5(str(user_data).strip().lower().encode('utf-8')).hexdigest()
    url = "https://robohash.org/{hash}.png?size={size}x{size}".format(
        hash=hash, size=size)
    return url
150330
public function getAvatarAttribute($avatar)
    {
        if (url()->isValidUrl($avatar)) {
            return $avatar;
        }

        $disk = config('admin.upload.disk');

        if ($avatar && array_key_exists($disk, config('filesystems.disks'))) {
            return Storage::disk(config('admin.upload.disk'))->url($avatar);
        }

        $default = config('admin.default_avatar') ?: '/vendor/laravel-admin/AdminLTE/dist/img/user2-160x160.jpg';

        return admin_asset($default);
    }
684309
def get_image_file_path(instance, filename):
    """"""
    ext = filename.split('.')[-1]
    filename = '%s.%s' % (uuid.uuid4(), ext)
    return os.path.join(
        'user_media', str(instance.user.pk), 'images', filename)
1148426
def avatar(self, size: int = 256) -> str:
        
        url = 'https://api.adorable.io/avatars/{0}/{1}.png'
        return url.format(size, self.password(hashed=True))
1370018
def __getAvatar(self, web):
        
        try:
            self.avatar = web.find("img", {"class": "avatar"})['src'][:-10]
        except IndexError as error:
            print("There was an error with the user " + self.name)
            print(error)
        except AttributeError as error:
            print("There was an error with the user " + self.name)
            print(error)
1110561
def images_path(self):
        
        server_config = Config.instance().get_section_config("Server")
        images_path = os.path.expanduser(server_config.get("images_path", "~/GNS3/projects"))
        os.makedirs(images_path, exist_ok=True)
        return images_path
1184431
def user_set_avatar(self, action=None, quick_key=None, url=None):
        
        return self.request("user/set_avatar", QueryParams({
            "action": action,
            "quick_key": quick_key,
            "url": url
        }))
555108
def upload(self, local_path, remote_url):
        """"""
        bucket, key = _parse_url(remote_url)

        with open(local_path, 'rb') as fp:
            return self.call("PutObject", bucket=bucket, key=key, body=fp)
812476
def update(data)
      update_avatar(data['avatar_url']) if data.key? 'avatar_url'
      update_displayname(data['displayname']) if data.key? 'displayname'
    end
897849
def users_set_avatar(self, avatar_url, **kwargs):
        """"""
        if avatar_url.startswith('http://') or avatar_url.startswith('https://'):
            return self.__call_api_post('users.setAvatar', avatarUrl=avatar_url, kwargs=kwargs)
        else:
            avatar_file = {"image": open(avatar_url, "rb")}
            return self.__call_api_post('users.setAvatar', files=avatar_file, kwargs=kwargs)
205215
def get_relative_path_from_img_id(img_id, variant_label=None, ext=None, create_dirs=False):
    
    profile, base_name = img_id.split(':', 1)
    conf = get_profile_configs(profile)
    if not variant_label:
        status_suffix = dju_settings.DJU_IMG_UPLOAD_MAIN_SUFFIX
    else:
        status_suffix = dju_settings.DJU_IMG_UPLOAD_VARIANT_SUFFIX
    name, file_ext = os.path.splitext(base_name)
    prefix = ''
    if name.startswith(dju_settings.DJU_IMG_UPLOAD_TMP_PREFIX):
        name = name[len(dju_settings.DJU_IMG_UPLOAD_TMP_PREFIX):]
        prefix = dju_settings.DJU_IMG_UPLOAD_TMP_PREFIX
    name_parts = name.split('_', 2)
    name = '{name}{status_suffix}{hash}'.format(
        name=name,
        status_suffix=status_suffix,
        hash=get_hash('_'.join(name_parts[:2]), variant_label=variant_label)
    )
    if variant_label:
        name += '_' + variant_label
    if ext:
        file_ext = ext
    elif variant_label:
        for var_conf in conf['VARIANTS']:
            var_conf_label = var_conf['LABEL'] or get_variant_label(var_conf)
            if var_conf_label == variant_label:
                if var_conf['FORMAT']:
                    file_ext = var_conf['FORMAT'].lower()
                break
    if file_ext and not file_ext.startswith('.'):
        file_ext = '.' + file_ext
    relative_path = os.path.join(
        dju_settings.DJU_IMG_UPLOAD_SUBDIR,
        conf['PATH'],
        name_parts[0][-2:],
        (prefix + name + file_ext)
    ).replace('\\', '/')
    if create_dirs:
        path = media_path(relative_path)
        make_dirs_for_file_path(path, mode=dju_settings.DJU_IMG_CHMOD_DIR)
    return relative_path
334347
private function createPathForUpload()
    {
        return sprintf(
            '%s://%s/%s.files',
            self::$streamWrapperProtocol,
            urlencode($this->databaseName),
            urlencode($this->bucketName)
        );
    }
929614
def path(self, path):
        

        self._path = self.manager.get_abs_image_path(path)
        log.info('IOU "{name}" [{id}]: IOU image updated to "{path}"'.format(name=self._name, id=self._id, path=self._path))
997206
public function getavatarpath(){
		if(empty($this->created)){
			return false;
			}
		if(empty($this->provider)){
			return false;
			}
		if(empty($this->social_id)){
			return false;
			}
		$avatarpath='/users/avatars/';
		$avatarpath.=$this->created->format('Y').'/';
		$avatarpath.=$this->created->format('m').'/';
		$avatarpath.=$this->created->format('d').'/';
		$avatarpath.=$this->provider.'-'.$this->social_id;
		return $avatarpath;
		}