yo35 / rpb-chessboard

A WordPress plugin to display chess games and diagrams (using the standard FEN and PGN notations).
https://wordpress.org/plugins/rpb-chessboard/
GNU General Public License v3.0
36 stars 16 forks source link

AMP support: show static image #143

Open paulschreiber opened 6 years ago

paulschreiber commented 6 years ago

On AMP pages, show a static image for chessboard images:

if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
  // render static image
} else {
 // rendering chessboard as usual
}
yo35 commented 5 years ago

Hi,

What do you mean by "a static image"? A PNG image held on the server-side, maybe to have it served from a CDN? This would require to generate the chessboard images on the server-side, thus refactor all the FEN parsing and board generation code, which is currently executed on the client-side.

I'm reluctant to implement two (or even more) different rendering processes for the chessboard, because of the additional maintenance and testing effort would not be sustainable.

paulschreiber commented 5 years ago

Yes, something would have to be generated on the server side.

You could use or create a third-party service that transforms chess boards to PNGs, like this one for math: https://s0.wp.com/latex.php?latex=i%5Chbar%5Cfrac%7B%5Cpartial%7D%7B%5Cpartial+t%7D%5Cleft%7C%5CPsi%28t%29%5Cright%3E%3DH%5Cleft%7C%5CPsi%28t%29%5Cright%3E&bg=ffffff&fg=000&s=0&zoom=4