eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.41k stars 536 forks source link

Is there a way I can use Staticman with images? #248

Closed ghost closed 4 years ago

ghost commented 5 years ago

I swear I saw a line of text saying that user generated images could now be used with Staticman. Is this true or did I misread something?

PS; Could you please make a version of staticman for Gitlab?

robinmoussu commented 5 years ago

@VincentTam was able to do it on his gitlab test, as you can see in his testing post, but I wasn't able to do the same.

VincentTam commented 5 years ago

Could you please make a version of staticman for Gitlab?

Yes, I did, in response to https://github.com/eduardoboucas/staticman/pull/219#issuecomment-417657297. What's more? Due to demand for Staticman on Framagit, I've deployed another public GitLab instance for Framagit.

Framagit and Staticman


To respond to the prompt in the title, yes in a weak sense. However, I think the response is negative au sensu stricto. I'm not sure if the current Staticman API can handle binary data---of course, you can always encode it in base64.

In the linked demo post that @robinmoussu has brought up, it's simply a Markdown syntax referring to an image that I've uploaded to my GitLab Pages in advance. If you really need images, I would recommend Stack Exchange's way. Upload them to a 3rd party image host first, then post their URL in the static comments written in Markdown.

P.S. Please avoid hot linking when using images from other sites. When you use an image from an external server, provided that you have the right to reuse that image, make a copy in another image host (preferably your domain) and use the URL for your copied image. Big sites like GitHub, Stack Exchange, big Discourse forums can automate this.

VincentTam commented 5 years ago

Updated answer: I've to correct my response for the strict sense, after my recent test comment on my demo Huginn + Framagit + Staticman site.

Screenshot_2019-06-26 Seconde Post – Huginn + Framagit + Staticman Image: My demo Huginn + Framagit + Staticman site with

  1. international language support
  2. nested comments
  3. base64 encoded image

You may try encoding images into base64, even though the encoded string is often larger than the binary image in terms of file size.