search

Home  >  Q&A  >  body text

android - 类似微信朋友圈的九宫格,图片是在图床上切成正方形给前端还是在前端在显示时再切成正方形

类似微信朋友圈的九宫格,图片是在图床上切成正方形给前端还是在前端在显示时再切成正方形

大家讲道理大家讲道理2892 days ago440

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 09:06:22

    Generally, the square display is processed in the backend, but it still depends on the specific needs. Returning such square thumbnails from the backend can speed up the display of the list, but if you want to view details, you will visit again. However, since it is impossible for every thumbnail to be clicked, it is processed by the backend. It is better to display thumbnails, but it is also possible if the backend does not provide it. You can directly obtain the original image and display it on the frontend, but it may be slower to load and consume more traffic at one time. When displaying a large image, there is no need to load it twice. The details depend on the overall consideration.

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:06:22

    Both methods can be achieved

    1. The server side provides two sets of pictures, one is a thumbnail that is scaled and cropped according to a square ratio, and the other is the original picture. The thumbnail is used for the nine-square grid, and the original picture is used to view the large picture after clicking.

    2. The server only provides the original image. The client downloads the original image locally, crops it according to the square ratio (the ratio is based on the specific screen resolution) and fills the nine-square grid. The function of the large image is the same as above.

    The reasonable method should be the first solution. The thumbnail size is small, the transmission is fast, and the user experience will be better.

    reply
    0
  • Cancelreply