A simple shitpost generator that pastes a random frame from Frinkiac to that "guys only want one thing" tweet.
See it in action here.
Do I really need to explain? It's a shitpost generator.
- Magick++ (
$ brew install imagemagick,$ sudo pacman -S imagemagick, etc.) - curl (the cli)
$ make
- Uses popen() to run shell commands (curl) because I was lazy
- Fetches a random frame from Frinkiac using curl
- Uses ImageMagick to paste the frame below the top image. The top image is stored in top_image_base64.cpp as base64-encoded string.
- The top image is resized a bit to match the bottom image. Frinkiac tends to have black vertical bars on both sides of the frame, hence the pixel offset when pasting the bottom image.
- Outputs the Image as base64-encoded jpeg.
$ echo "extern const char * const TOP_IMAGE_BASE64 = \"`base64 -w 0 < NEW_IMAGE`\";" > top_image_base64.cpp
where NEW_IMAGE is the path to your new image in any format supported by ImageMagick.
Then recompile.
The frontend is a simple php script that executes make_image and puts the base64-encoded image data directly into the html.
I have the server laid out so that the http root is at a public/ directory, but scripts are below the public directory. The frontend just contains symlinks to the scripts. So for example:
public/
public/shitpostgen/index.php -> ../../shitpostgen/index.php
shitpostgen/
shitpostgen/index.php
shitpostgen/make_image
shitpostgen/...<etc>...
