Count image views

前端 未结 6 1880
余生分开走
余生分开走 2021-01-25 08:14

I would like to have code for an image that counts the number of times the image is viewed, regardless of what site the image is found on. I want to use the img src tag, and hav

6条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 09:02

    Loading images / files from php is slow than normal loading files.

    Main cons:

    • Images can't be cached due to dynamic query most browser dont support on dynamic queries.
    • Overhead on sever and apache both.

    If you use database and want to increment column after image loads than a person can load your image again and again. So you need to use conditions on every query.

    Alternative Solution

    Enter this code in footer of page on which you want to show images

    A ajax call

    $.get("inc_img_view.php?img_id="+);
    

提交回复
热议问题