jackwilsdon/go-ppic

Add support for mirroring in the URL

jackwilsdon opened this issue · 1 comments

Currently the Generate and GenerateImage methods accept arguments specifying whether or not the image should be mirrored on the X and Y axis, but it is hard-coded to mirror only on the X axis in the server request handler.

It'd be nice to have support for specifying how to mirror the image in the URL, much like how image size is specified;

https://ppic.now.sh/example.png?mirror=x,y

Or possibly;

https://ppic.now.sh/example.png?mirrorX=false&mirrorY

(where no value is true)

We should probably still default to mirroring on the X to preserve images as they are now.

I think a good implementation of this would be the first example I gave (with a slight alteration):

# No mirroring
https://ppic.now.sh/example.png?mirror=
# Mirroring along the X axis (default)
https://ppic.now.sh/example.png?mirror=x
# Mirroring along the Y axis
https://ppic.now.sh/example.png?mirror=y
# Mirroring along both axes
https://ppic.now.sh/example.png?mirror=xy

Any invalid axes passed with the mirroring option should probably cause an error to be returned.