The application is a simple fitness tracker online for smartphones. It is necessary to display statistics - to build beautiful graphics in the browser on the user's page.

The first option is to build a graph on the server and then send the finished picture. The second option is to send values ​​and build a graph on the client’s side.

The second option is like for the following reasons:

  • the amount of data to send is quite small and they will go faster than a beautiful picture

  • although the build function does not require a lot of resources - I would like to see it on the client side, at least a little, but unload the server

  • a variety of libraries with a bunch of settings for js more than php

  • Of course there is a security issue - the transfer of customer data, but I doubt that someone will want to steal fitness data from a novice developer.

In general, I tend to work on JS, but I would like to know if there are any points that could incline PHP in my case.

From the found theory I know that the processing of images on the server occurs only when it is impossible to show the processing code (so that they do not steal it), or when the processing requires high power.

  • one
    The picture is static. With js schedule you can interact. Your processing code will be on the server anyway. The server also sends information about the points of the schedule - ArchDemon
  • one
    It makes sense to generate a picture on the server in the following cases: Captcha (or something similar) - which would be harder to crack. Also, a chart with historical information that does not change, i.e. once generated a picture, saved to the server. On the client it is cached, there is no load on the server or on the client. - Stepan Kasyanenko
  • Stepan, I think there are many other cases. For example (not my example, just to vskidku) - let's say you want to change the photo so that it looks like a picture in the style of impressionism and you do not want your js code to be on the side. In this case, it is also worth using server processing. - OO
  • ArchDemon, it turns out on the server we do all the statics, and what requires interactivity - we process with js? - OO

1 answer 1

On php will be more difficult to implement. If there is no reason to do server side security issues, then js is definitely preferable. It will work faster, it will be possible to make the graphics interactive, the traffic will be less.