Git Product home page Git Product logo

oxigen's Introduction

oxigen

Social media image generator

docker run -d -p 80:80 ghcr.io/yznts/oxigen:latest

Oxigen is a dynamic social media image generator, which gives you an ability to easily create, customize and use og images with both UI and API.

Example

oxigen's People

Contributors

yznts avatar rowdyhcs avatar

Stargazers

 avatar Léopold Koprivnik avatar rohit sohlot avatar  avatar Michael Conner avatar  avatar Sven Hohlfeld avatar Christoph Berger avatar Andy Piper avatar Eaden McKee avatar  avatar thefourCraft avatar Iftekhar Inan avatar  avatar  avatar santosh avatar Ruslan Korennoy avatar plusone.eth avatar Julian avatar Marcus André avatar Roman Hossain Shaon avatar Lawrence Onah avatar Dan Lourenco avatar Elias Häußler avatar Daan Debie avatar Ahmet Hakan Beşel avatar  avatar Phillip W. avatar Damian Ślimak avatar Ryan E avatar Marlon Frade avatar  avatar Mr.HyperBit avatar Felipe Barros avatar Devenir Entrepreneur Web - Automatisation avatar Alexander J. Rodriguez D. avatar  avatar bozzfozz avatar Kyle S avatar Maxwell Morais avatar  avatar Andrey avatar Lex avatar  avatar Dav-id avatar  avatar Nathanael Piquet avatar  avatar Berkay Toptan avatar  avatar ThéoCouss avatar Loan TALVAT avatar Raoul Simionas avatar Domi avatar TheH2SO4 avatar Chase avatar  avatar Akash Goswami avatar Michael Taylor avatar Jacky Ly avatar Joshua Anderson avatar Darryl Gibbs avatar Zatoufly avatar  avatar Michał Bielejewski  avatar LarryKHite avatar VampDev avatar Christian Nicola avatar  avatar  avatar Joris U. avatar Zoë B avatar Jared Wolff avatar  avatar Mateusz Pstrucha avatar Yohann Fabri avatar  avatar Alessandro Gambin da Silva avatar tom avatar Peter Krzyzek avatar Maddi avatar Varun Sridharan avatar NetGuy avatar Nikita avatar Ворон avatar  avatar ElYoM avatar ⚡️Justice Nefe⚡️ avatar Jérôme Foray avatar Altan S avatar Preslav Rachev avatar xhemj avatar Byron Hambly avatar Renan Altendorf avatar pyunramura avatar AJ Tatum avatar  avatar Hamzah Muhammad avatar Mr avatar Daniel Phan avatar

Watchers

 avatar  avatar

oxigen's Issues

Docker instruction syntax incorrect

❯ docker run ghcr.io/yuriizinets/oxigen:latest -p 9001:8000
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-p": executable file not found in $PATH: unknown.
ERRO[0001] error waiting for container:

I managed to resolve this by swapping the order around, and noticed there is a pull request which has this fix ready as well. Thanks @mre

#10

Docker image seems broken

After running the docker image, it seems to not load the web ui. Logs say it's ready at port 8000. No other warnings or anything. Any ideas?

EDIT: I figured it out. The container calls for port 8000 so the ports should be

80:8000 not 80:80 as shown in the readme :)

EDIT2: Yeah, the Docker image needs work. Tried it in a few browsers and it's not loading any images. Even with the default values.

Docker instruction syntax incorrect

❯ docker run ghcr.io/yuriizinets/oxigen:latest -p 9001:8000
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-p": executable file not found in $PATH: unknown.
ERRO[0001] error waiting for container:

I managed to resolve this by swapping the order around, and noticed there is a pull request which has this fix ready as well. Thanks @mre

#10

Error handling

Handle errors and give reasonable response, for both API and UI

Logo image size

After we got control over the size of the image, there was a problem with the size of the logo. If we want to get a smaller output image, then the logo takes up almost the entire space, for example:
Снимок экрана 2023-01-18 в 14 32 10

Image width: 600;
Image height: 300;

And vice versa, if you set the dimensions larger, the logo comes out too small:
Снимок экрана 2023-01-18 в 14 34 54

Image width: 2400;
Image height: 1200;

As a suggestion, either add control over the size of the logo as well, or at least calculate its size as a percentage

Fonts are not loading from embed.FS

While running oxigen binary (not as docker container), there is an error related to fonts loading (originally reported here).

Serving on ::8000
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET / HTTP/1.1" 200 15410
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /ui?title=Oxigen%3A+Social+media+image+generator&author=%40yuriizinets&website=github.com%2Fyuriizinets%2Foxigen&logo=https%3A%2F%2Fimgur.com%2FkKUt9Pt.png&background=https%3A%2F%2Fimgur.com%2F8K6rdoZ.png&dim=110 HTTP/1.1" 200 15264
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /ui?title=Oxigen%3A+Social+media+image+generator&author=%40yuriizinets&website=github.com%2Fyuriizinets%2Foxigen&logo=https%3A%2F%2Fimgur.com%2FkKUt9Pt.png&background=https%3A%2F%2Fimgur.com%2F8K6rdoZ.png&dim=110 HTTP/1.1" 200 15264
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
2023/01/13 17:21:26 http: panic serving 172.17.0.1:57316: error while reading font file
goroutine 70 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a2d0}, 0xc000204c00)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a2d0?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002161c0}, 0xc000204c00)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002161c0}, 0xc00039c900)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc000385e60?}, {0xc7b858, 0xc0002161c0}, 0xc00039c900)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0003bc1e0, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:28 http: panic serving 172.17.0.1:57306: error while reading font file
goroutine 15 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a500}, 0xc000176400)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a500?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216380}, 0xc000176400)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216380}, 0xc000205600)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac7b0?}, {0xc7b858, 0xc000216380}, 0xc000205600)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa140, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:31 http: panic serving 172.17.0.1:57292: error while reading font file
goroutine 6 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc0000261e0}, 0xc000204200)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc0000261e0?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216000}, 0xc000204200)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216000}, 0xc000205100)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc00007f9b0?}, {0xc7b858, 0xc000216000}, 0xc000205100)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000001e00, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:34 http: panic serving 172.17.0.1:57298: error while reading font file
goroutine 14 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a2d0}, 0xc000204400)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a2d0?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002160e0}, 0xc000204400)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002160e0}, 0xc000205700)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac6c0?}, {0xc7b858, 0xc0002160e0}, 0xc000205700)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa0a0, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:36 http: panic serving 172.17.0.1:57318: error while reading font file
goroutine 55 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc0000262d0}, 0xc000176300)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc0000262d0?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216000}, 0xc000176300)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216000}, 0xc000176100)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ad320?}, {0xc7b858, 0xc000216000}, 0xc000176100)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0003bc5a0, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:38 http: panic serving 172.17.0.1:38978: error while reading font file
goroutine 160 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
        /usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a280}, 0xc000282200)
        /src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a280?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002160e0}, 0xc000282200)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002160e0}, 0xc000176200)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac0c0?}, {0xc7b858, 0xc0002160e0}, 0xc000176200)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa0a0, {0xc7c440, 0xc00007f8c0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db

Panic when using non supported format

I just tried the tool from the docker container and used an SVG as image (which seems to not be supported). The app then paniced unrecoverably.

I suggest not panic-ing in a web service and add proper error handling instead.

2023/01/14 17:48:41 http: panic serving 172.17.0.1:56382: image: unknown format
goroutine 463 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x85cb80, 0xc000112e00})
        /usr/local/go/src/runtime/panic.go:890 +0x262
git.sr.ht/~kyoto-framework/zen.Must[...]({0x0?, 0x0?}, {0xc78280?, 0xc000112e00?})
        /go/pkg/mod/git.sr.ht/~kyoto-framework/[email protected]/errors.go:7 +0x4e
main.AGenerate({0xc7bf58, 0xc000142280}, 0xc0000f0200)
        /src/api.generate.go:165 +0xeb5
net/http.HandlerFunc.ServeHTTP(0xc7b8f8?, {0xc7bf58?, 0xc000142280?}, 0x0?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78be0, 0xc000110060}, {0xc79640, 0xbfd230}, 0xbfcf80}, {0xc7b8f8, 0xc000284000}, 0xc0000f0200)
        /go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00018c0c0, {0xc7b8f8, 0xc000284000}, 0xc0000f0000)
        /go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc00078a2d0?}, {0xc7b8f8, 0xc000284000}, 0xc0000f0000)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0000f60a0, {0xc7c4e0, 0xc000115980})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.