dongmi4734 2016-06-24 23:46
浏览 41
已采纳

Laravel 5.2 - 如何在加载所有内容之前呈现页面

I've another question about Laravel.

I've got gallery in my project which loads a lot of images (currently it's about 80 but it will still grow). The way I'm loading images is easy - in controller I get all the records from photos table and just passing them to view. In view I have foreach loop which shows every image.

The problem is that Laravel is probably caching the rendered page and then loads it. It causes gallery page long lasting loading (now between 5-10 sec depends on server load).

Am I right that it firstly caches the rendered page and then loads it? Will using faster caching package solve the problem? Or is there any other way to speed up site loading?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • dongxu7408 2016-06-25 01:55
    关注

    What you want goes beyond Laravel and the slow load time is due to the amount of time it takes for the client to download the images. (Unless of course you are sending the images in base64 which would be quite strange in this case.)

    Here is how others have solved this problem:

    • Create thumbnails for all the images and full size images are viewed after a thumbnail link is clicked.
    • Use a JavaScript to load the images.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?