GG资源网

从WordPress网页上的目录中分页所有图像

问题描述:

I need to show in a PHP web page all the images in a folder. A pagination is required. The images can be more than 10,000, so a good performance is important, and here is where my doubt comes from, what is more efficient?

  • Paginate the images of the folder using scandir.

  • Automatically save the name of all images in a database and load them with a Mysqli query (probably also convenient to use a temporary cache).

  • Any other suggestions you can give me.

The website uses WordPress as the engine, but the images are uploaded to a subdomain using a PHP file isolated from WordPress ...

I thought about saving the name of all the images like a WordPress Custom-Post-Type (using mysqli basic queries) and paginate them like any other publication, but I think that, due to the amount, it would harm the overall performance of the website (because the custom-post-type are saved in the same table as the other publications)...

The website receives more than 30 thousand daily visits that it must support.

PD: Sorry for the bad explanation but it is complicated to explain, and more in another language.

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~
功能建议

我需要在 PHP </ code>网页中显示文件夹中的所有图像。 需要分页。 图像可以超过10,000,所以良好的性能很重要,这是我怀疑的地方,更有效的是什么?</ p>

  • Paginate the 使用 scandir </ code>的文件夹图像。</ p> </ li>

  • 自动保存数据库中所有图像的名称并使用 Mysqli <加载它们 / code> query(可能也方便使用临时缓存)。</ p> </ li>

  • 您可以给我任何其他建议。</ p> </ li>
    < / ul>

    该网站使用 WordPress </ code>作为引擎,但使用与Wordpress隔离的PHP文件将图像上传到子域... </ p>
    \\ n

    我想保存所有图像的名称,如 WordPress Custom-Post-Type </ code>(使用 mysqli </ code>基本查询),并像任何其他出版物一样对它们进行分页, 但我认为,由于数量的原因,它会损害网站的整体性能(因为 custom-post-type </ code>与其他出版物保存在同一个表中)...... </ p>

    该网站每天必须支持超过3万次访问。</ p>

    PD:很抱歉这个说法不好,但解释起来很复杂, 更多用另一种语言。</ em> </ p>
    </ div>

    网友观点:

    Use a custom table or a second database.

    You are right to consider avoiding repeatedly calling scandir for every paginated request.
    You can access the global $wpdb object and do custom queries to manage the contents of your directory.

    I\'d lean towards just managing the image data separately from WordPress. Since you are already using a non WP upload script just create a new DB and use it to keep track of the directory contents in that script. Then paginated results is a very simple DB query. This keeps the WP database smaller and faster and is not overkill for the magnitude of images and visits you must handle.

由于网站搬家,部分链接失效,如无法下载,请联系站长!谢谢支持!
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » 从WordPress网页上的目录中分页所有图像

发表回复

CAPTCHAis initialing...
© 2021-GG资源网 - www.ggplus.cn. All rights reserved