简体   繁体   English

用户头像在wordpress中如何工作?

[英]How user avatar works in wordpress?

I am working on a migration work to WordPress for a site where all user images of old site has to set as avatars in WordPress buddypress profile. 我正在为网站的WordPress迁移工作,其中旧站点的所有用户图像都必须设置为WordPress buddypress配置文件中的化身。

I wrote a PHP script to migrate all users along with passwords and working fine. 我写了一个PHP脚本来迁移所有用户以及密码,并且工作正常。

My problem is how to set user avatar using PHP code (not WordPress code). 我的问题是如何使用PHP代码(而非WordPress代码)设置用户头像。 I didn't understand how it is storing and where in tables it is storing. 我不明白它的存储方式以及它在表中的存储位置。 I know the location it is storing be in format like, 我知道它要存储的位置格式如下:

wp_content/uploads/avatars/userid/randomtext.jpg wp_content /上传/化身/用户名/ randomtext.jpg

How this randomtext.jpg is generating and where this information is saving? 这个randomtext.jpg是如何生成的以及该信息保存在哪里?

Can anyone help me? 谁能帮我?

Thats it you dont have to create any random text. 就是这样,您不必创建任何随机文本。 Just create a directory with userid as name in inside "avatars" folder and save two images like say for userid (22), 只需在“头像”文件夹中创建一个以用户ID作为名称的目录,然后保存两个图像,例如用户ID(22),

wp_content/uploads/avatars/22/22-bpfull.jpg (150x150px) wp_content/uploads/avatars/22/22-bpthumb.jpg (50x50px) wp_content / uploads / avatars / 22 / 22-bpfull.jpg(150x150px)wp_content / uploads / avatars / 22 / 22-bpthumb.jpg(50x50px)

or wp_content/uploads/avatars/22/anyname-bpfull.jpg wp_content/uploads/avatars/22/anyname-bpthumb.jpg 或wp_content / uploads / avatars / 22 / anyname-bpfull.jpg wp_content / uploads / avatars / 22 / anyname-bpthumb.jpg

Thats it. 而已。 No need to store in any table. 无需存储在任何表中。 Just create images in respective directories. 只需在相应目录中创建图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM